- -Wmultichar implemented
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Wed, 19 Dec 2007 17:02:39 +0000 (17:02 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Wed, 19 Dec 2007 17:02:39 +0000 (17:02 +0000)
[r18810]

parser.c
warning.c
warning.h

index 68f9fcd..6c97705 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -3167,7 +3167,7 @@ static expression_t *parse_char_const(void)
        cnst->conste.v.chars.size  = token.v.string.size;
 
        if (cnst->conste.v.chars.size != 1) {
-               if (c_mode & _GNUC) {
+               if (warning.multichar && (c_mode & _GNUC)) {
                        /* TODO */
                        warningf(HERE, "multi-character character constant");
                } else {
index 7d9c434..c102f9c 100644 (file)
--- a/warning.c
+++ b/warning.c
@@ -13,6 +13,7 @@ warning_t warning = {
        .main                          = true,
        .missing_declarations          = false,
        .missing_prototypes            = false,
+       .multichar                     = true,
        .redundant_decls               = true,
        .s_are_errors                  = false,
        .shadow                        = false,
@@ -87,6 +88,7 @@ void set_warning_opt(const char *const opt)
        OPT("main",                          main)
        OPT("missing-declarations",          missing_declarations)
        OPT("missing-prototypes",            missing_prototypes)
+       OPT("multichar",                     multichar)
        OPT("redundant-decls",               redundant_decls)
        OPT("shadow",                        shadow)
        OPT("sign-compare",                  sign_compare)
index 71d9a88..9edd8fb 100644 (file)
--- a/warning.h
+++ b/warning.h
@@ -42,8 +42,8 @@ typedef struct warning_t {
        bool missing_noreturn:1;              /**< Warn about functions which might be candidates for attribute 'noreturn' */
 #endif
        bool missing_prototypes:1;            /**< Warn if a global function is defined without a previous prototype declaration */
-#if 0 // TODO
        bool multichar:1;                     /**< Warn if a multicharacter constant ('FOOF') is used. */
+#if 0 // TODO
        bool nested_externs:1;                /**< Warn if an 'extern' declaration is encountered within a function */
        bool packed:1;                        /**< Warn if a structure is given the packed attribute, but the packed attribute has no effect on the layout or size of the structure */
        bool padded:1;                        /**< Warn if padding is included in a structure, either to align an element of the structure or to align the whole structure */