Unified · Split
| @@ -98,9 +98,11 @@ extern long double strtold (const char *__nptr, char **__endptr); · 97 unmodified lines | |||
| 98 | #ifdef _MSC_VER | 98 | #ifdef _MSC_VER |
| 99 | # define NORETURN __declspec(noreturn) | 99 | # define NORETURN __declspec(noreturn) |
| 100 | # define ALIGNED(x) __declspec(align(x)) | 100 | # define ALIGNED(x) __declspec(align(x)) |
| 101 | # define PRINTF_LIKE(x,y) | ||
| 101 | #else | 102 | #else |
| 102 | # define NORETURN __attribute__((noreturn)) | 103 | # define NORETURN __attribute__((noreturn)) |
| 103 | # define ALIGNED(x) __attribute__((aligned(x))) | 104 | # define ALIGNED(x) __attribute__((aligned(x))) |
| 105 | # define PRINTF_LIKE(x,y) __attribute__ ((format (printf, (x), (y)))) | ||
| 104 | #endif | 106 | #endif |
| 105 | 107 | ||
| 106 | /* gnu headers use to #define __attribute__ to empty for non-gcc compilers */ | 108 | /* gnu headers use to #define __attribute__ to empty for non-gcc compilers */ |
| @@ -1206,9 +1208,9 @@ PUB_FUNC char *tcc_strdup_debug(const char *str, const char *file, int line); · 1099 unmodified lines | |||
| 1206 | #define realloc(p, s) use_tcc_realloc(p, s) | 1208 | #define realloc(p, s) use_tcc_realloc(p, s) |
| 1207 | #undef strdup | 1209 | #undef strdup |
| 1208 | #define strdup(s) use_tcc_strdup(s) | 1210 | #define strdup(s) use_tcc_strdup(s) |
| 1209 | PUB_FUNC void _tcc_error_noabort(const char *fmt, ...); | 1211 | PUB_FUNC void _tcc_error_noabort(const char *fmt, ...) PRINTF_LIKE(1,2); |
| 1210 | PUB_FUNC NORETURN void _tcc_error(const char *fmt, ...); | 1212 | PUB_FUNC NORETURN void _tcc_error(const char *fmt, ...) PRINTF_LIKE(1,2); |
| 1211 | PUB_FUNC void _tcc_warning(const char *fmt, ...); | 1213 | PUB_FUNC void _tcc_warning(const char *fmt, ...) PRINTF_LIKE(1,2); |
| 1212 | 1214 | ||
| 1213 | /* other utilities */ | 1215 | /* other utilities */ |
| 1214 | ST_FUNC void dynarray_add(void *ptab, int *nb_ptr, void *data); | 1216 | ST_FUNC void dynarray_add(void *ptab, int *nb_ptr, void *data); |
| @@ -1218,7 +1220,7 @@ ST_FUNC void cstr_cat(CString *cstr, const char *str, int len); · 3 unmodified lines | |||
| 1218 | ST_FUNC void cstr_wccat(CString *cstr, int ch); | 1220 | ST_FUNC void cstr_wccat(CString *cstr, int ch); |
| 1219 | ST_FUNC void cstr_new(CString *cstr); | 1221 | ST_FUNC void cstr_new(CString *cstr); |
| 1220 | ST_FUNC void cstr_free(CString *cstr); | 1222 | ST_FUNC void cstr_free(CString *cstr); |
| 1221 | ST_FUNC int cstr_printf(CString *cs, const char *fmt, ...); | 1223 | ST_FUNC int cstr_printf(CString *cs, const char *fmt, ...) PRINTF_LIKE(2,3); |
| 1222 | ST_FUNC void cstr_reset(CString *cstr); | 1224 | ST_FUNC void cstr_reset(CString *cstr); |
| 1223 | 1225 | ||
| 1224 | ST_INLN void sym_free(Sym *sym); | 1226 | ST_INLN void sym_free(Sym *sym); |
| @@ -108,7 +108,7 @@ static void asm_expr_unary(TCCState *s1, ExprValue *pe) · 107 unmodified lines | |||
| 108 | if (sym && (!sym->c || elfsym(sym)->st_shndx == SHN_UNDEF)) | 108 | if (sym && (!sym->c || elfsym(sym)->st_shndx == SHN_UNDEF)) |
| 109 | sym = sym->prev_tok; | 109 | sym = sym->prev_tok; |
| 110 | if (!sym) | 110 | if (!sym) |
| 111 | tcc_error("local label '%d' not found backward", n); | 111 | tcc_error("local label '%d' not found backward", (int)n); |
| 112 | } else { | 112 | } else { |
| 113 | /* forward */ | 113 | /* forward */ |
| 114 | if (!sym || (sym->c && elfsym(sym)->st_shndx != SHN_UNDEF)) { | 114 | if (!sym || (sym->c && elfsym(sym)->st_shndx != SHN_UNDEF)) { |
| @@ -2808,7 +2808,7 @@ ST_FUNC int tcc_load_object_file(TCCState *s1, · 2807 unmodified lines | |||
| 2808 | ) { | 2808 | ) { |
| 2809 | invalid_reloc: | 2809 | invalid_reloc: |
| 2810 | tcc_error_noabort("Invalid relocation entry [%2d] '%s' @ %.8x", | 2810 | tcc_error_noabort("Invalid relocation entry [%2d] '%s' @ %.8x", |
| 2811 | i, strsec + sh->sh_name, rel->r_offset); | 2811 | i, strsec + sh->sh_name, (int)rel->r_offset); |
| 2812 | goto fail; | 2812 | goto fail; |
| 2813 | } | 2813 | } |
| 2814 | rel->r_info = ELFW(R_INFO)(sym_index, type); | 2814 | rel->r_info = ELFW(R_INFO)(sym_index, type); |
| @@ -368,7 +368,8 @@ ST_FUNC void test_lvalue(void) · 367 unmodified lines | |||
| 368 | ST_FUNC void check_vstack(void) | 368 | ST_FUNC void check_vstack(void) |
| 369 | { | 369 | { |
| 370 | if (vtop != vstack - 1) | 370 | if (vtop != vstack - 1) |
| 371 | tcc_error("internal compiler error: vstack leak (%d)", vtop - vstack + 1); | 371 | tcc_error("internal compiler error: vstack leak (%d)", |
| 372 | (int)(vtop - vstack + 1)); | ||
| 372 | } | 373 | } |
| 373 | 374 | ||
| 374 | /* ------------------------------------------------------------------------- */ | 375 | /* ------------------------------------------------------------------------- */ |
| @@ -8071,7 +8072,7 @@ static int decl0(int l, int is_for_loop_init, Sym *func_sym) · 7696 unmodified lines | |||
| 8071 | skip(','); | 8072 | skip(','); |
| 8072 | parse_mult_str(&error_str, "string constant"); | 8073 | parse_mult_str(&error_str, "string constant"); |
| 8073 | if (c == 0) | 8074 | if (c == 0) |
| 8074 | tcc_error("%s", error_str.data); | 8075 | tcc_error("%s", (char *)error_str.data); |
| 8075 | cstr_free(&error_str); | 8076 | cstr_free(&error_str); |
| 8076 | skip(')'); | 8077 | skip(')'); |
| 8077 | static_assert_out: | 8078 | static_assert_out: |
| @@ -3150,7 +3150,7 @@ static int paste_tokens(int t1, CValue *v1, int t2, CValue *v2) · 3149 unmodified lines | |||
| 3150 | if (is_space(tok)) | 3150 | if (is_space(tok)) |
| 3151 | continue; | 3151 | continue; |
| 3152 | tcc_warning("pasting \"%.*s\" and \"%s\" does not give a valid" | 3152 | tcc_warning("pasting \"%.*s\" and \"%s\" does not give a valid" |
| 3153 | " preprocessing token", n, cstr.data, (char*)cstr.data + n); | 3153 | " preprocessing token", n, (char *)cstr.data, (char*)cstr.data + n); |
| 3154 | ret = 0; | 3154 | ret = 0; |
| 3155 | break; | 3155 | break; |
| 3156 | } | 3156 | } |