authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2016-02-16 20:34:45-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2016-02-16 21:43:38-07:00
log06398a22d0905e7e45ee7bdf4755aeee3b3fc1b0
treebb15986ed033624e04fc82a96bd4f50da244963e
parentbb806f941c81cca140b7554eac130fd365df871f

back to normal print specifiers

disable warnings for format specifiers on mingw since the compiler emits bogus warnings

4 files changed, 13 insertions(+), 9 deletions(-)

CMakeLists.txt+6-1
......@@ -181,7 +181,12 @@ include_directories(
181181
182182set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Werror -Wall")
183183
184set(EXE_CFLAGS "-std=c++11 -fno-exceptions -fno-rtti -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Werror=strict-prototypes -Werror=old-style-definition -Werror=missing-prototypes")
184
185if(MINGW)
186 set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wno-error=format= -Wno-error=format -Wno-error=format-extra-args")
187endif()
188
189set(EXE_CFLAGS "-std=c++11 -fno-exceptions -fno-rtti -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__USE_MINGW_ANSI_STDIO -Werror=strict-prototypes -Werror=old-style-definition -Werror=missing-prototypes")
185190
186191add_executable(zig ${ZIG_SOURCES})
187192set_target_properties(zig PROPERTIES
src/analyze.cpp+4-4
......@@ -396,7 +396,7 @@ TypeTableEntry *get_array_type(CodeGen *g, TypeTableEntry *child_type, uint64_t
396396 entry->zero_bits = (array_size == 0) || child_type->zero_bits;
397397
398398 buf_resize(&entry->name, 0);
399 buf_appendf(&entry->name, "[%" PRIuMAX "]%s", (uintmax_t)array_size, buf_ptr(&child_type->name));
399 buf_appendf(&entry->name, "[%" PRIu64 "]%s", array_size, buf_ptr(&child_type->name));
400400
401401 if (!entry->zero_bits) {
402402 uint64_t debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, entry->type_ref);
......@@ -4158,9 +4158,9 @@ static TypeTableEntry *analyze_builtin_fn_call_expr(CodeGen *g, ImportTableEntry
41584158 uint64_t src_align = get_memcpy_align(g, src_type->data.pointer.child_type);
41594159 if (dest_align != src_align) {
41604160 add_node_error(g, dest_node, buf_sprintf(
4161 "misaligned memcpy, '%s' has alignment '%" PRIuMAX ", '%s' has alignment %" PRIuMAX,
4162 buf_ptr(&dest_type->name), (uintmax_t)dest_align,
4163 buf_ptr(&src_type->name), (uintmax_t)src_align));
4161 "misaligned memcpy, '%s' has alignment '%" PRIu64 ", '%s' has alignment %" PRIu64,
4162 buf_ptr(&dest_type->name), dest_align,
4163 buf_ptr(&src_type->name), src_align));
41644164 }
41654165 }
41664166
src/ast_render.cpp+2-2
......@@ -351,7 +351,7 @@ void ast_print(FILE *f, AstNode *node, int indent) {
351351 NumLit kind = node->data.number_literal.kind;
352352 const char *name = node_type_str(node->type);
353353 if (kind == NumLitUInt) {
354 fprintf(f, "%s uint %" PRIuMAX "\n", name, (uintmax_t)node->data.number_literal.data.x_uint);
354 fprintf(f, "%s uint %" PRIu64 "\n", name, node->data.number_literal.data.x_uint);
355355 } else {
356356 fprintf(f, "%s float %f\n", name, node->data.number_literal.data.x_float);
357357 }
......@@ -679,7 +679,7 @@ static void render_node(AstRender *ar, AstNode *node) {
679679 case NodeTypeNumberLiteral:
680680 switch (node->data.number_literal.kind) {
681681 case NumLitUInt:
682 fprintf(ar->f, "%" PRIuMAX, (uintmax_t)node->data.number_literal.data.x_uint);
682 fprintf(ar->f, "%" PRIu64, node->data.number_literal.data.x_uint);
683683 break;
684684 case NumLitFloat:
685685 fprintf(ar->f, "%f", node->data.number_literal.data.x_float);
src/bignum.cpp+1-2
......@@ -265,8 +265,7 @@ Buf *bignum_to_buf(BigNum *bn) {
265265 return buf_sprintf("%f", bn->data.x_float);
266266 } else {
267267 const char *neg = bn->is_negative ? "-" : "";
268 uintmax_t value = bn->data.x_uint;
269 return buf_sprintf("%s%" PRIuMAX, neg, value);
268 return buf_sprintf("%s%llu", neg, bn->data.x_uint);
270269 }
271270}
272271