Le 11/03/2013 20:32, Gregg Smith a écrit :
On 3/11/2013 9:38 AM, j...@apache.org wrote:
Author: jim
Date: Mon Mar 11 16:38:39 2013
New Revision: 1455225

URL: http://svn.apache.org/r1455225
Log:
Merge r1442865, r1442759, r1442326, r1442309, r1448171, r1418556, r1448453, r1425771, r1425772, r1425775 from trunk:

...

Add some __attribute__ for automatic format checking.
Correct one catch in sed0.c.

Modified: httpd/httpd/branches/2.4.x/include/util_filter.h
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/include/util_filter.h?rev=1455225&r1=1455224&r2=1455225&view=diff ==============================================================================
--- httpd/httpd/branches/2.4.x/include/util_filter.h (original)
+++ httpd/httpd/branches/2.4.x/include/util_filter.h Mon Mar 11 16:38:39 2013
@@ -332,8 +332,8 @@ AP_DECLARE(apr_status_t) ap_pass_brigade
  AP_DECLARE(apr_status_t) ap_pass_brigade_fchk(request_rec *r,
apr_bucket_brigade *bucket,
                                                const char *fmt,
-                                              ...);
-
+                                              ...)
+ __attribute__((format(printf,3,4)));

  /**
   * This function is used to register an input filter with the system.

Modified: httpd/httpd/branches/2.4.x/modules/filters/regexp.h
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/filters/regexp.h?rev=1455225&r1=1455224&r2=1455225&view=diff ==============================================================================
--- httpd/httpd/branches/2.4.x/modules/filters/regexp.h (original)
+++ httpd/httpd/branches/2.4.x/modules/filters/regexp.h Mon Mar 11 16:38:39 2013
@@ -69,7 +69,8 @@ typedef struct _sed_comp_args {

extern char *sed_compile(sed_commands_t *commands, sed_comp_args *compargs,
                           char *ep, char *endbuf, int seof);
-extern void command_errf(sed_commands_t *commands, const char *fmt, ...); +extern void command_errf(sed_commands_t *commands, const char *fmt, ...)
+                         __attribute__((format(printf,2,3)));

  #define SEDERR_CGMES "command garbled: %s"
  #define SEDERR_SMMES "Space missing before filename: %s"

Modified: httpd/httpd/branches/2.4.x/modules/filters/sed0.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/filters/sed0.c?rev=1455225&r1=1455224&r2=1455225&view=diff ==============================================================================
--- httpd/httpd/branches/2.4.x/modules/filters/sed0.c (original)
+++ httpd/httpd/branches/2.4.x/modules/filters/sed0.c Mon Mar 11 16:38:39 2013
@@ -275,7 +275,7 @@ comploop:
          }

          if(p>  &commands->respace[RESIZE-1]) {
-            command_errf(commands, SEDERR_TMMES);
+            command_errf(commands, SEDERR_TMMES, commands->linebuf);
              return -1;
          }


AFIAK, __attribute__ is gcc specific. What about non-gcc compilers? What's might be a consequence of a compiler ignoring it (as MSVC does), or will it break any other non-gcc compilers?

Gregg


I proposed it because there was already some __attribute__ elsewhere in the source code. It also helped me trigger some missing parameters, so I thought it would be useful to keep and share it.

Should there be an issue with other compiler, IMO we would already be aware of it. It should also be possible to define a macro that expand to nothing if the compiler is not gcc.

CJ

Reply via email to