INN commit: trunk (10 files)

INN Commit rra at isc.org
Sun Sep 21 09:15:26 UTC 2014


    Date: Sunday, September 21, 2014 @ 02:15:25
  Author: iulius
Revision: 9700

Improve the use of the __attribute__ GCC keyword

When __attribute__ is used, be sure to include portable/macros.h
so that this GCC keyword is hidden to compilers that do not
recognize it.

Also use double underscores around "noreturn" and "packed".

Modified:
  trunk/include/inn/dbz.h
  trunk/include/inn/libinn.h
  trunk/include/portable/setproctitle.h
  trunk/innd/art.c
  trunk/innd/innd.h
  trunk/innfeed/misc.h
  trunk/lib/Makefile
  trunk/lib/asprintf.c
  trunk/nnrpd/nnrpd.h
  trunk/tests/lib/asprintf-t.c

---------------------------------+
 include/inn/dbz.h               |   18 ++++++------------
 include/inn/libinn.h            |    3 ++-
 include/portable/setproctitle.h |    1 +
 innd/art.c                      |    1 +
 innd/innd.h                     |    7 +++++--
 innfeed/misc.h                  |    1 +
 lib/Makefile                    |    3 +--
 lib/asprintf.c                  |    1 +
 nnrpd/nnrpd.h                   |    7 +++++--
 tests/lib/asprintf-t.c          |    1 +
 10 files changed, 24 insertions(+), 19 deletions(-)

Modified: include/inn/dbz.h
===================================================================
--- include/inn/dbz.h	2014-09-21 06:36:55 UTC (rev 9699)
+++ include/inn/dbz.h	2014-09-21 09:15:25 UTC (rev 9700)
@@ -3,6 +3,7 @@
 
 /* Need the definition of HASH. */
 #include "inn/libinn.h"
+#include "portable/macros.h"
 
 BEGIN_DECLS
 
@@ -38,24 +39,17 @@
     bool             nonblock;
 } dbzoptions;
 
-#ifdef __GNUC__
-#define PACKED __attribute__ ((packed))
-#else
-#if !defined(PACKED)
-#define PACKED
-#endif
-#endif
-
 #if !defined(lint) && (defined(__SUNPRO_C) || defined(_nec_ews))
 #pragma pack(1)
 #endif /* nor lint, nor __SUNPRO_C, nor sgi, nor _nec_ews */
-/* Leave the PACKED on there because removing it might change the layout of
- * the data structure on disk on some platform, thus invalidating old history
- * files.  It is fairly unlikely that this is a problem, though.
+/* Leave the __attribute__ ((__packed__)) on there because removing it
+ * might change the layout of the data structure on disk on some platform,
+ * thus invalidating old history files.
+ * It is fairly unlikely that this is a problem, though.
  */
 typedef struct {
     char		hash[DBZ_INTERNAL_HASH_SIZE];
-} PACKED erec;
+} __attribute__ ((__packed__)) erec;
 #if !defined(lint) && (defined(__SUNPRO_C) || defined(_nec_ews))
 #pragma pack()
 #endif /* nor lint, nor__SUNPRO_C, nor _nec_ews */

Modified: include/inn/libinn.h
===================================================================
--- include/inn/libinn.h	2014-09-21 06:36:55 UTC (rev 9699)
+++ include/inn/libinn.h	2014-09-21 09:15:25 UTC (rev 9700)
@@ -99,7 +99,8 @@
 
 /* Various checks. */
 extern bool             IsValidArticleNumber(const char *string);
-extern bool             IsValidKeyword(const char *string) __attribute__ ((pure));
+extern bool             IsValidKeyword(const char *string)
+    __attribute__ ((__pure__));
 extern bool             IsValidRange(char *string);
 
 

Modified: include/portable/setproctitle.h
===================================================================
--- include/portable/setproctitle.h	2014-09-21 06:36:55 UTC (rev 9699)
+++ include/portable/setproctitle.h	2014-09-21 09:15:25 UTC (rev 9700)
@@ -11,6 +11,7 @@
 #define PORTABLE_SETPROCTITLE_H 1
 
 #include "config.h"
+#include "portable/macros.h"
 
 #if !HAVE_SETPROCTITLE || !HAVE_DECL_SETPROCTITLE
 void setproctitle(const char *format, ...)

Modified: innd/art.c
===================================================================
--- innd/art.c	2014-09-21 06:36:55 UTC (rev 9699)
+++ innd/art.c	2014-09-21 09:15:25 UTC (rev 9700)
@@ -5,6 +5,7 @@
 
 #include "config.h"
 #include "clibrary.h"
+#include "portable/macros.h"
 #include <sys/uio.h>
 
 #include "inn/innconf.h"

Modified: innd/innd.h
===================================================================
--- innd/innd.h	2014-09-21 06:36:55 UTC (rev 9699)
+++ innd/innd.h	2014-09-21 09:15:25 UTC (rev 9700)
@@ -28,6 +28,7 @@
 #define INND_H 1
 
 #include "config.h"
+#include "portable/macros.h"
 #include "portable/socket.h"
 #include <ctype.h>
 #include <errno.h>
@@ -697,7 +698,8 @@
 extern char         *	MaxLength(const char *p, const char *q);
 extern pid_t		Spawn(int niceval, int fd0, int fd1, int fd2,
 			      char * const av[]);
-extern void		CleanupAndExit(int x, const char *why) __attribute__ ((noreturn));
+extern void		CleanupAndExit(int x, const char *why)
+    __attribute__ ((__noreturn__));
 extern void		JustCleanup(void);
 extern void		ThrottleIOError(const char *when);
 extern void		ThrottleNoMatchError(void);
@@ -727,7 +729,8 @@
 extern char	    *   CHANname(CHANNEL *cp);
 extern int		CHANreadtext(CHANNEL *cp);
 extern void		CHANclose(CHANNEL *cp, const char *name);
-extern void		CHANreadloop(void) __attribute__ ((noreturn));
+extern void		CHANreadloop(void)
+    __attribute__ ((__noreturn__));
 extern void		CHANsetup(int i);
 extern void		CHANshutdown(void);
 extern void		CHANtracing(CHANNEL *cp, bool Flag);

Modified: innfeed/misc.h
===================================================================
--- innfeed/misc.h	2014-09-21 06:36:55 UTC (rev 9699)
+++ innfeed/misc.h	2014-09-21 09:15:25 UTC (rev 9700)
@@ -9,6 +9,7 @@
 #define misc_h__
 
 #include "config.h"
+#include "portable/macros.h"
 
 #include <stdarg.h>
 #include <sys/types.h>

Modified: lib/Makefile
===================================================================
--- lib/Makefile	2014-09-21 06:36:55 UTC (rev 9699)
+++ lib/Makefile	2014-09-21 09:15:25 UTC (rev 9700)
@@ -552,8 +552,7 @@
 seteuid.o: seteuid.c ../include/config.h ../include/inn/defines.h \
   ../include/inn/system.h ../include/inn/macros.h \
   ../include/portable/macros.h ../include/portable/stdbool.h \
-  ../include/inn/options.h ../include/clibrary.h ../include/config.h \
-  ../include/inn/macros.h
+  ../include/inn/options.h
 setproctitle.o: setproctitle.c ../include/config.h \
   ../include/inn/defines.h ../include/inn/system.h ../include/inn/macros.h \
   ../include/portable/macros.h ../include/portable/stdbool.h \

Modified: lib/asprintf.c
===================================================================
--- lib/asprintf.c	2014-09-21 06:36:55 UTC (rev 9699)
+++ lib/asprintf.c	2014-09-21 09:15:25 UTC (rev 9700)
@@ -21,6 +21,7 @@
 
 #include "config.h"
 #include "clibrary.h"
+#include "portable/macros.h"
 
 #include <errno.h>
 

Modified: nnrpd/nnrpd.h
===================================================================
--- nnrpd/nnrpd.h	2014-09-21 06:36:55 UTC (rev 9699)
+++ nnrpd/nnrpd.h	2014-09-21 09:15:25 UTC (rev 9700)
@@ -4,6 +4,7 @@
 */
 
 #include "config.h"
+#include "portable/macros.h"
 #include "portable/socket.h"
 
 #include <ctype.h>
@@ -221,7 +222,8 @@
 extern int		LockPostRec(char *path);
 extern void		UnlockPostRec(char *path);
 extern int		RateLimit(long *sleeptime, char *path);
-extern void		ExitWithStats(int x, bool readconf) __attribute__ ((noreturn));
+extern void		ExitWithStats(int x, bool readconf)
+    __attribute__ ((__noreturn__));
 extern char		*GetHeader(const char *header, bool stripspaces);
 extern void		GRPreport(void);
 extern bool		NGgetlist(char ***argvp, char *list);
@@ -250,7 +252,8 @@
 extern void             CMDnextlast     (int ac, char** av);
 extern void             CMDover         (int ac, char** av);
 extern void             CMDpost         (int ac, char** av);
-extern void             CMDquit         (int ac, char** av) __attribute__ ((noreturn));
+extern void             CMDquit         (int ac, char** av)
+    __attribute__ ((__noreturn__));
 extern void             CMDxgtitle      (int ac, char** av);
 extern void             CMDpat          (int ac, char** av);
 extern void             CMD_unimp       (int ac, char** av);

Modified: tests/lib/asprintf-t.c
===================================================================
--- tests/lib/asprintf-t.c	2014-09-21 06:36:55 UTC (rev 9699)
+++ tests/lib/asprintf-t.c	2014-09-21 09:15:25 UTC (rev 9700)
@@ -20,6 +20,7 @@
 
 #include "config.h"
 #include "clibrary.h"
+#include "portable/macros.h"
 
 #include "tap/basic.h"
 



More information about the inn-committers mailing list