Skip to content

Commit

Permalink
LibC: Enable compiler warnings for printf format strings
Browse files Browse the repository at this point in the history
  • Loading branch information
ccapitalK authored and awesomekling committed Dec 26, 2020
1 parent 1cfdaf9 commit 6b01d1c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions AK/kstdio.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
# include <AK/Types.h>
# include <stdarg.h>
extern "C" {
int vdbgprintf(const char* fmt, va_list);
int dbgprintf(const char* fmt, ...);
int vdbgprintf(const char* fmt, va_list) __attribute__((format(printf, 1, 0)));
int dbgprintf(const char* fmt, ...) __attribute__((format(printf, 1, 2)));
int dbgputstr(const char*, ssize_t);
int sprintf(char* buf, const char* fmt, ...);
int snprintf(char* buffer, size_t, const char* fmt, ...);
int sprintf(char* buf, const char* fmt, ...) __attribute__((format(printf, 2, 3)));
int snprintf(char* buffer, size_t, const char* fmt, ...) __attribute__((format(printf, 3, 4)));
}
# endif
#else
Expand Down
6 changes: 3 additions & 3 deletions Kernel/kstdio.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
#include <AK/Types.h>

extern "C" {
int dbgprintf(const char* fmt, ...);
int dbgprintf(const char* fmt, ...) __attribute__((format(printf, 1, 2)));
int dbgputstr(const char*, int);
int kernelputstr(const char*, int);
int kprintf(const char* fmt, ...);
int snprintf(char* buf, size_t, const char* fmt, ...);
int kprintf(const char* fmt, ...) __attribute__((format(printf, 1, 2)));
int snprintf(char* buf, size_t, const char* fmt, ...) __attribute__((format(printf, 3, 4)));
void set_serial_debug(bool on_or_off);
int get_serial_debug();
}
18 changes: 9 additions & 9 deletions Libraries/LibC/stdio.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,17 @@ int feof(FILE*);
int fflush(FILE*);
size_t fread(void* ptr, size_t size, size_t nmemb, FILE*);
size_t fwrite(const void* ptr, size_t size, size_t nmemb, FILE*);
int vprintf(const char* fmt, va_list);
int vfprintf(FILE*, const char* fmt, va_list);
int vsprintf(char* buffer, const char* fmt, va_list);
int vsnprintf(char* buffer, size_t, const char* fmt, va_list);
int fprintf(FILE*, const char* fmt, ...);
int printf(const char* fmt, ...);
int dbgprintf(const char* fmt, ...);
int vprintf(const char* fmt, va_list) __attribute__((format(printf, 1, 0)));
int vfprintf(FILE*, const char* fmt, va_list) __attribute__((format(printf, 2, 0)));
int vsprintf(char* buffer, const char* fmt, va_list) __attribute__((format(printf, 2, 0)));
int vsnprintf(char* buffer, size_t, const char* fmt, va_list) __attribute__((format(printf, 3, 0)));
int fprintf(FILE*, const char* fmt, ...) __attribute__((format(printf, 2, 3)));
int printf(const char* fmt, ...) __attribute__((format(printf, 1, 2)));
int dbgprintf(const char* fmt, ...) __attribute__((format(printf, 1, 2)));
void dbgputch(char);
int dbgputstr(const char*, ssize_t);
int sprintf(char* buffer, const char* fmt, ...);
int snprintf(char* buffer, size_t, const char* fmt, ...);
int sprintf(char* buffer, const char* fmt, ...) __attribute__((format(printf, 2, 3)));
int snprintf(char* buffer, size_t, const char* fmt, ...) __attribute__((format(printf, 3, 4)));
int putchar(int ch);
int putc(int ch, FILE*);
int puts(const char*);
Expand Down

0 comments on commit 6b01d1c

Please sign in to comment.