From: Taylor R Campbell Date: Tue, 8 Jan 2019 06:06:46 +0000 (+0000) Subject: Suppress uninitialized variable warnings. X-Git-Tag: mit-scheme-pucked-10.1.10~6^2~68 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=3bbd8432169461af9af0e6f3e8e307637d28d9ae;p=mit-scheme.git Suppress uninitialized variable warnings. GCC is easily confused by the code we generate. --- diff --git a/src/compiler/machines/C/cutl.scm b/src/compiler/machines/C/cutl.scm index 6a1d6c182..be23d5530 100644 --- a/src/compiler/machines/C/cutl.scm +++ b/src/compiler/machines/C/cutl.scm @@ -410,7 +410,9 @@ USA. (define (c:decl type var #!optional val) (c:line (c:type type) " " (c:var var) - (if (default-object? val) "" (string-append " = " (c:expr val))) + (if (default-object? val) + (string-append " LIARC_UNINITIALIZED(" (c:var var) ")") + (string-append " = " (c:expr val))) ";")) (define (c:decl-unused type var #!optional val) diff --git a/src/microcode/liarc.h b/src/microcode/liarc.h index e9cd7cd22..ad63529f9 100644 --- a/src/microcode/liarc.h +++ b/src/microcode/liarc.h @@ -64,6 +64,12 @@ union machine_word_u typedef union machine_word_u machine_word; typedef unsigned long entry_count_t; +#ifdef __GNUC__ +#define LIARC_UNINITIALIZED(name) = name +#else +#define LIARC_UNINITIALIZED(name) +#endif + #define ADDRESS_UNITS_PER_OBJECT SIZEOF_SCHEME_OBJECT #define ADDRESS_UNITS_PER_FLOAT (sizeof (double))