CodingStyle: Allow C99 mixing of declarations and code.
authorJarno Rajahalme <jrajahalme@nicira.com>
Wed, 28 May 2014 23:56:29 +0000 (16:56 -0700)
committerJarno Rajahalme <jrajahalme@nicira.com>
Wed, 28 May 2014 23:56:29 +0000 (16:56 -0700)
As even the MSVC 2013 now supports the C99 mixing of declarations and
code, we can now allow them in OVS code.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
CodingStyle
acinclude.m4
configure.ac

index bae8cd6..0ba0366 100644 (file)
@@ -515,7 +515,7 @@ global variables.
 
 C DIALECT
 
-  Some C99 features are OK because they are widely implemented:
+  Most C99 features are OK because they are widely implemented:
 
     * Flexible array members (e.g. struct { int foo[]; }).
 
@@ -533,16 +533,15 @@ C DIALECT
     * Designated initializers (e.g. "struct foo foo = {.a = 1};" and
       "int a[] = {[2] = 5};").
 
-  Don't use other C99 features that are not widely implemented in
-older compilers:
+    * Mixing of declarations and code within a block.  Please use this
+      judiciously; keep declarations nicely grouped together in the
+      beginning of a block if possible.
 
-    * Don't mix declarations and code within a block.
-
-    * Don't use declarations in iteration statements (e.g. don't write
+    * Use of declarations in iteration statements (e.g.
       "for (int i = 0; i < 10; i++)").
 
-    * Don't put a trailing comma in an enum declaration (e.g. don't
-      write "enum { x = 1, };").
+    * Use of a trailing comma in an enum declaration (e.g.
+      "enum { x = 1, };").
 
   As a matter of style, avoid // comments.
 
index 5ed02d2..bd71a82 100644 (file)
@@ -403,7 +403,7 @@ dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
 
 AC_DEFUN([_OVS_CHECK_CC_OPTION], [dnl
-  m4_define([ovs_cv_name], [ovs_cv_[]m4_translit([$1], [-], [_])])dnl
+  m4_define([ovs_cv_name], [ovs_cv_[]m4_translit([$1], [-=], [__])])dnl
   AC_CACHE_CHECK([whether $CC accepts $1], [ovs_cv_name], 
     [ovs_save_CFLAGS="$CFLAGS"
      dnl Include -Werror in the compiler options, because without -Werror
index 3379ff6..4bf69e8 100644 (file)
@@ -100,7 +100,6 @@ OVS_ENABLE_OPTION([-Wall])
 OVS_ENABLE_OPTION([-Wextra])
 OVS_ENABLE_OPTION([-Wno-sign-compare])
 OVS_ENABLE_OPTION([-Wpointer-arith])
-OVS_ENABLE_OPTION([-Wdeclaration-after-statement])
 OVS_ENABLE_OPTION([-Wformat-security])
 OVS_ENABLE_OPTION([-Wno-format-zero-length])
 OVS_ENABLE_OPTION([-Wswitch-enum])