[PATCH 5/7] simplify definition of __STRICT_ANSI__

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 lib.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/lib.c b/lib.c
index 02f6231e2..d232b8cee 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)
-- 
2.24.0




[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux