summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-08-08 17:45:05 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2019-12-01 21:34:00 +0100
commit073711199faa206c78c06141d235b88c71f5476c (patch)
tree9e26f3d6ebd03d473c8f679b56d8f66deb14ad5b
parent252027fac5e2611ade29dc13cf896970595e5b9b (diff)
downloadsparse-073711199faa206c78c06141d235b88c71f5476c.tar.gz
simplify definition of __STRICT_ANSI__
Currently, the definition of __STRICT_ANSI__ is done in the same switch statement used for __STDC_VERSION__. However, this lead to some repetions that can be avoided if moved outside of the switch. Move the definition of __STRICT_ANSI__ out of the switch statement and guard it by testing the absence of STANDARD_GNU. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--lib.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/lib.c b/lib.c
index 02f6231e..078a15a9 100644
--- a/lib.c
+++ b/lib.c
@@ -1408,24 +1408,16 @@ static void predefined_macros(void)
default:
break;
- case STANDARD_C89:
- predefine("__STRICT_ANSI__", 1, "1");
- case STANDARD_GNU89:
- break;
-
case STANDARD_C94:
- predefine("__STRICT_ANSI__", 1, "1");
predefine("__STDC_VERSION__", 1, "199409L");
break;
case STANDARD_C99:
- predefine("__STRICT_ANSI__", 1, "1");
case STANDARD_GNU99:
predefine("__STDC_VERSION__", 1, "199901L");
break;
case STANDARD_C11:
- predefine("__STRICT_ANSI__", 1, "1");
case STANDARD_GNU11:
predefine("__STDC_NO_ATOMICS__", 1, "1");
predefine("__STDC_NO_COMPLEX__", 1, "1");
@@ -1433,6 +1425,8 @@ static void predefined_macros(void)
predefine("__STDC_VERSION__", 1, "201112L");
break;
}
+ if (!(standard & STANDARD_GNU) && (standard != STANDARD_NONE))
+ predefine("__STRICT_ANSI__", 1, "1");
predefine("__CHAR_BIT__", 1, "%d", bits_in_char);
if (funsigned_char)