This is mentioned as a FIXME under gcc/doc/sourcebuild.texi
I was not able to submit the patch with CVS (never used it before). At https://gcc.gnu.org/about.html#cvs it says:
cvs -q -d :ext:username@gcc.gnu.org:/cvs/gcc checkout -P wwwdocs where username is your user name at gcc.gnu.org
but I could not find know how to obtain such username.
This is the diff -u:
--- htdocs/codingconventions.html 2014-07-09 02:03:05.000000000 +0200 +++ codingconventions2.html 2015-05-16 11:49:39.000000000 +0200 @@ -30,8 +30,13 @@
- Assertions
- Character Testing
-
<li><a href="#Empty_Macro_Arguments">Empty Macro Arguments</a></li> <li><a href="#Error">Error Node Testing</a></li>
-
<li><a href="#Free_NULL_Check">Free NULL Check</a></li>
-
<li><a href="#Long_Integer_Literal_Suffix">Long Integer Literal Suffix</a></li> <li><a href="#Generated">Parameters Affecting Generated Code</a></li>
-
<li><a href="#Parenthesis_Around_String_Initializers">Parenthesis Around String Initializers</a></li>
-
<li><a href="#Trigraphs">Trigraphs</a></li> <li><a href="#C_Inlining">Inlining Functions</a></li> </ul>
free (P); +
@@ -708,6 +713,24 @@ language accepted.
+
+ +ISO C (6.8.3 in the 1990 standard) specifies the following:
+ +If (before argument substitution) any argument consists of no +preprocessing tokens, the behavior is undefined.+ +
This was relaxed by ISO C99, but some older compilers emit an error, +so code like:
+ ++ ++#define foo(x, y) x y +foo (bar, ) +
needs to be coded in some other way.
+ +Testing for ERROR_MARK
s should be done by comparing
@@ -716,12 +739,67 @@
href="https://gcc.gnu.org/ml/gcc-patches/2000-10/msg00792.html">message.
+
+ +Don't check if a pointer is NULL
before freeing it.
Since SunOS 4 stopped being a reasonable portability target,
+(which happened around 2007) there has been no need to guard
+against free (NULL)
. Thus, any guard like the following
+constitutes a redundant test:
+if (P)
+
However, if your profiling exposes a test like this in a
+performance-critical loop, say where P is nearly always NULL
, and
+the cost of calling free on a NULL
pointer would be prohibitively
+high, consider using __builtin_expect
, e.g., like this:
+if (__builtin_expect (ptr != NULL, 0))
free (ptr); +
+
+ +Never use lower case l
since it can be confused
+with the number 1
. Use upper case L
instead.
Internal numeric parameters that may affect generated code should
be controlled by --param
rather than being hardcoded.
+
+ +Don't use parenthesis around string initializers.
+ +
Irix6 cc -n32
and OSF4 cc
have problems with
+constant string initializers with parenthesis around it, e.g.:
+ ++const char string[] = ("A string"); +
This is unfortunate since this is what the GNU gettext macro N_
+produces. You need to find a different way to code it.
+ +
Some compilers like MSVC++ have fairly low limits on the maximum +length of a string literal; 509 is the lowest we've come across. You +may need to break up a long printf statement into many smaller ones.
+ + + + +Don't use trigraphs because some compilers do not accept them.
+ +