Move local variable declaration closer to its use.
[cparser] / parser.c
index d5a31ad..225f3b4 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -6314,10 +6314,10 @@ static expression_t *parse_character_constant(void)
        cnst->conste.v.character = token.v.string;
 
        if (cnst->conste.v.character.size != 1) {
-               if (warning.multichar && GNU_MODE) {
+               if (!GNU_MODE) {
+                       errorf(HERE, "more than 1 character in character constant");
+               } else if (warning.multichar) {
                        warningf(HERE, "multi-character character constant");
-               } else {
-                       errorf(HERE, "more than 1 characters in character constant");
                }
        }
        next_token();
@@ -6335,10 +6335,10 @@ static expression_t *parse_wide_character_constant(void)
        cnst->conste.v.wide_character = token.v.wide_string;
 
        if (cnst->conste.v.wide_character.size != 1) {
-               if (warning.multichar && GNU_MODE) {
+               if (!GNU_MODE) {
+                       errorf(HERE, "more than 1 character in character constant");
+               } else if (warning.multichar) {
                        warningf(HERE, "multi-character character constant");
-               } else {
-                       errorf(HERE, "more than 1 characters in character constant");
                }
        }
        next_token();
@@ -7442,8 +7442,6 @@ static expression_t *parse_typeprop(expression_kind_t const kind)
 
        eat(kind == EXPR_SIZEOF ? T_sizeof : T___alignof__);
 
-       char const* const what = kind == EXPR_SIZEOF ? "sizeof" : "alignof";
-
        /* we only refer to a type property, mark this case */
        bool old     = in_type_prop;
        in_type_prop = true;
@@ -7481,6 +7479,7 @@ typeprop_expression:
                type->kind == TYPE_BITFIELD ? "bitfield"            :
                NULL;
        if (wrong_type != NULL) {
+               char const* const what = kind == EXPR_SIZEOF ? "sizeof" : "alignof";
                errorf(&tp_expression->base.source_position,
                                "operand of %s expression must not be of %s type '%T'",
                                what, wrong_type, orig_type);