[PATCH] Use _X_ATTRIBUTE_PRINTF _X_DEPRECATED _X_NORETURN

Jeremy Huddleston jeremyhu at apple.com
Wed May 12 20:42:08 PDT 2010


Use the values from xproto rather than duplicating the effort

Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
---
 hw/xfree86/common/xf86.h |   12 ++++++------
 include/misc.h           |   12 ------------
 include/os.h             |   34 +++++++++++++---------------------
 include/resource.h       |    8 ++++----
 os/log.c                 |    2 +-
 5 files changed, 24 insertions(+), 44 deletions(-)

diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h
index e9266ab..4544a4f 100644
--- a/hw/xfree86/common/xf86.h
+++ b/hw/xfree86/common/xf86.h
@@ -210,14 +210,14 @@ extern _X_EXPORT void xf86EnableDisableFBAccess(int scrnIndex, Bool enable);
 extern _X_EXPORT void xf86VDrvMsgVerb(int scrnIndex, MessageType type, int verb,
 		     const char *format, va_list args);
 extern _X_EXPORT void xf86DrvMsgVerb(int scrnIndex, MessageType type, int verb,
-		    const char *format, ...) _printf_attribute(4,5);
+		    const char *format, ...) _X_ATTRIBUTE_PRINTF(4,5);
 extern _X_EXPORT void xf86DrvMsg(int scrnIndex, MessageType type, const char *format, ...)
-		_printf_attribute(3,4);
+		_X_ATTRIBUTE_PRINTF(3,4);
 extern _X_EXPORT void xf86MsgVerb(MessageType type, int verb, const char *format, ...)
-		_printf_attribute(3,4);
-extern _X_EXPORT void xf86Msg(MessageType type, const char *format, ...) _printf_attribute(2,3);
-extern _X_EXPORT void xf86ErrorFVerb(int verb, const char *format, ...) _printf_attribute(2,3);
-extern _X_EXPORT void xf86ErrorF(const char *format, ...) _printf_attribute(1,2);
+		_X_ATTRIBUTE_PRINTF(3,4);
+extern _X_EXPORT void xf86Msg(MessageType type, const char *format, ...) _X_ATTRIBUTE_PRINTF(2,3);
+extern _X_EXPORT void xf86ErrorFVerb(int verb, const char *format, ...) _X_ATTRIBUTE_PRINTF(2,3);
+extern _X_EXPORT void xf86ErrorF(const char *format, ...) _X_ATTRIBUTE_PRINTF(1,2);
 extern _X_EXPORT const char *xf86TokenToString(SymTabPtr table, int token);
 extern _X_EXPORT int xf86StringToToken(SymTabPtr table, const char *string);
 extern _X_EXPORT void xf86ShowClocks(ScrnInfoPtr scrp, MessageType from);
diff --git a/include/misc.h b/include/misc.h
index e4bdee4..62d813e 100644
--- a/include/misc.h
+++ b/include/misc.h
@@ -100,18 +100,6 @@ typedef unsigned long ATOM;
 #define FALSE 0
 #endif
 
-#ifdef __GNUC__
-#define X_DEPRECATED __attribute__((deprecated))
-#else
-#define X_DEPRECATED
-#endif
-
-#if defined(__GNUC__) && (__GNUC__ > 2)
-#define X_NORETURN __attribute__((noreturn))
-#else
-#define X_NORETURN
-#endif
-
 #ifndef _XTYPEDEF_CALLBACKLISTPTR
 typedef struct _CallbackList *CallbackListPtr; /* also in dix.h */
 #define _XTYPEDEF_CALLBACKLISTPTR
diff --git a/include/os.h b/include/os.h
index d34e056..efa202c 100644
--- a/include/os.h
+++ b/include/os.h
@@ -218,20 +218,20 @@ extern _X_EXPORT int set_font_authorizations(
 /*
  * Use malloc(3) instead.
  */
-extern _X_EXPORT void *Xalloc(unsigned long /*amount*/) X_DEPRECATED;
+extern _X_EXPORT void *Xalloc(unsigned long /*amount*/) _X_DEPRECATED;
 /*
  * Use calloc(3) instead
  */
-extern _X_EXPORT void *Xcalloc(unsigned long /*amount*/) X_DEPRECATED;
+extern _X_EXPORT void *Xcalloc(unsigned long /*amount*/) _X_DEPRECATED;
 /*
  * Use realloc(3) instead
  */
 extern _X_EXPORT void *Xrealloc(void * /*ptr*/, unsigned long /*amount*/)
-    X_DEPRECATED;
+    _X_DEPRECATED;
 /*
  * Use free(3) instead
  */
-extern _X_EXPORT void Xfree(void * /*ptr*/) X_DEPRECATED;
+extern _X_EXPORT void Xfree(void * /*ptr*/) _X_DEPRECATED;
 
 #endif
 
@@ -263,9 +263,9 @@ extern _X_EXPORT char *Xstrdup(const char *s);
  */
 extern _X_EXPORT char *XNFstrdup(const char *s);
 
-extern _X_EXPORT char *Xprintf(const char *fmt, ...);
+extern _X_EXPORT char *Xprintf(const char *fmt, ...) _X_ATTRIBUTE_PRINTF(1,2);
 extern _X_EXPORT char *Xvprintf(const char *fmt, va_list va);
-extern _X_EXPORT char *XNFprintf(const char *fmt, ...);
+extern _X_EXPORT char *XNFprintf(const char *fmt, ...) _X_ATTRIBUTE_PRINTF(1,2);
 extern _X_EXPORT char *XNFvprintf(const char *fmt, va_list va);
 
 typedef void (*OsSigHandlerPtr)(int /* sig */);
@@ -299,7 +299,7 @@ extern _X_EXPORT void OsBlockSignals (void);
 
 extern _X_EXPORT void OsReleaseSignals (void);
 
-extern _X_EXPORT void OsAbort (void) X_NORETURN;
+extern _X_EXPORT void OsAbort (void) _X_NORETURN;
 
 #if !defined(WIN32)
 extern _X_EXPORT int System(char *);
@@ -525,29 +525,21 @@ typedef enum {
     X_UNKNOWN = -1		/* unknown -- this must always be last */
 } MessageType;
 
-/* XXX Need to check which GCC versions have the format(printf) attribute. */
-#if defined(__GNUC__) && (__GNUC__ > 2)
-#define _printf_attribute(a,b) __attribute((format(__printf__,a,b)))
-#else
-#define _printf_attribute(a,b) /**/
-#endif
-
 extern _X_EXPORT const char *LogInit(const char *fname, const char *backup);
 extern _X_EXPORT void LogClose(void);
 extern _X_EXPORT Bool LogSetParameter(LogParameter param, int value);
 extern _X_EXPORT void LogVWrite(int verb, const char *f, va_list args);
-extern _X_EXPORT void LogWrite(int verb, const char *f, ...) _printf_attribute(2,3);
+extern _X_EXPORT void LogWrite(int verb, const char *f, ...) _X_ATTRIBUTE_PRINTF(2,3);
 extern _X_EXPORT void LogVMessageVerb(MessageType type, int verb, const char *format,
 			    va_list args);
 extern _X_EXPORT void LogMessageVerb(MessageType type, int verb, const char *format,
-			   ...) _printf_attribute(3,4);
+			   ...) _X_ATTRIBUTE_PRINTF(3,4);
 extern _X_EXPORT void LogMessage(MessageType type, const char *format, ...)
-			_printf_attribute(2,3);
+			_X_ATTRIBUTE_PRINTF(2,3);
 extern _X_EXPORT void FreeAuditTimer(void);
-extern _X_EXPORT void AuditF(const char *f, ...) _printf_attribute(1,2);
+extern _X_EXPORT void AuditF(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2);
 extern _X_EXPORT void VAuditF(const char *f, va_list args);
-extern _X_EXPORT void FatalError(const char *f, ...) _printf_attribute(1,2)
-    X_NORETURN;
+extern _X_EXPORT void FatalError(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2) _X_NORETURN;
 
 #ifdef DEBUG
 #define DebugF ErrorF
@@ -556,7 +548,7 @@ extern _X_EXPORT void FatalError(const char *f, ...) _printf_attribute(1,2)
 #endif
 
 extern _X_EXPORT void VErrorF(const char *f, va_list args);
-extern _X_EXPORT void ErrorF(const char *f, ...) _printf_attribute(1,2);
+extern _X_EXPORT void ErrorF(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2);
 extern _X_EXPORT void Error(char *str);
 extern _X_EXPORT void LogPrintMarkers(void);
 
diff --git a/include/resource.h b/include/resource.h
index 56450d6..96f852a 100644
--- a/include/resource.h
+++ b/include/resource.h
@@ -256,24 +256,24 @@ extern _X_EXPORT pointer SecurityLookupIDByType(
     ClientPtr client,
     XID id,
     RESTYPE rtype,
-    Mask access_mode) X_DEPRECATED;
+    Mask access_mode) _X_DEPRECATED;
 
 /* replaced by dixLookupResourceByClass */
 extern _X_EXPORT pointer SecurityLookupIDByClass(
     ClientPtr client,
     XID id,
     RESTYPE classes,
-    Mask access_mode) X_DEPRECATED;
+    Mask access_mode) _X_DEPRECATED;
 
 /* replaced by dixLookupResourceByType */
 extern _X_EXPORT pointer LookupIDByType(
     XID id,
-    RESTYPE rtype) X_DEPRECATED;
+    RESTYPE rtype) _X_DEPRECATED;
 
 /* replaced by dixLookupResourceByClass */
 extern _X_EXPORT pointer LookupIDByClass(
     XID id,
-    RESTYPE classes) X_DEPRECATED;
+    RESTYPE classes) _X_DEPRECATED;
 
 #endif /* RESOURCE_H */
 
diff --git a/os/log.c b/os/log.c
index 0781659..ce43319 100644
--- a/os/log.c
+++ b/os/log.c
@@ -403,7 +403,7 @@ LogMessage(MessageType type, const char *format, ...)
 }
 
 void
-AbortServer(void) X_NORETURN;
+AbortServer(void) _X_NORETURN;
 
 void
 AbortServer(void)
-- 
1.7.1




More information about the xorg-devel mailing list