xkbcomp: Clean up utils prototypes Includes using a macro for the gcc format attributes instead of repeated ifdef's.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258
diff --git a/src/xkbcomp/utils.h b/src/xkbcomp/utils.h
index 2d69033..acf6e14 100644
--- a/src/xkbcomp/utils.h
+++ b/src/xkbcomp/utils.h
@@ -72,21 +72,20 @@ typedef int Comparison;
/***====================================================================***/
-extern Opaque uAlloc(unsigned /* size */
- );
-extern Opaque uCalloc(unsigned /* n */ ,
- unsigned /* size */
- );
-extern Opaque uRealloc(Opaque /* old */ ,
- unsigned /* newSize */
- );
-extern Opaque uRecalloc(Opaque /* old */ ,
- unsigned /* nOld */ ,
- unsigned /* nNew */ ,
- unsigned /* newSize */
- );
-extern void uFree(Opaque /* ptr */
- );
+extern Opaque
+uAlloc(unsigned size);
+
+extern Opaque
+uCalloc(unsigned n, unsigned size);
+
+extern Opaque
+uRealloc(Opaque old, unsigned newSize);
+
+extern Opaque
+uRecalloc(Opaque old, unsigned nOld, unsigned nNew, unsigned newSize);
+
+extern void
+uFree(Opaque ptr);
#define uTypedAlloc(t) ((t *)uAlloc((unsigned)sizeof(t)))
#define uTypedCalloc(n,t) ((t *)uCalloc((unsigned)n,(unsigned)sizeof(t)))
@@ -102,81 +101,58 @@ extern void uFree(Opaque /* ptr */
/***====================================================================***/
-extern Boolean uSetErrorFile(char * /* name */
- );
-
-#define INFO uInformation
+extern Boolean
+uSetErrorFile(char *name);
-extern void
-uInformation(const char * /* s */ , ...
- )
#if defined(__GNUC__) && \
((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 6)))
- __attribute__ ((format(printf, 1, 2)))
+#define __ATTR_PRINTF(i, f) __attribute__ ((format(printf, (i), (f))))
+#else
+#define __ATTR_PRINTF(i, f)
#endif
- ;
+
+#define INFO uInformation
+
+extern __ATTR_PRINTF(1, 2) void
+uInformation(const char *s, ...);
#define ACTION uAction
- extern void uAction(const char * /* s */ , ...
- )
-#if defined(__GNUC__) && \
- ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 6)))
- __attribute__ ((format(printf, 1, 2)))
-#endif
- ;
+extern __ATTR_PRINTF(1, 2) void
+uAction(const char *s, ...);
#define WARN uWarning
- extern void uWarning(const char * /* s */ , ...
- )
-#if defined(__GNUC__) && \
- ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 6)))
- __attribute__ ((format(printf, 1, 2)))
-#endif
- ;
+extern __ATTR_PRINTF(1, 2) void
+uWarning(const char *s, ...);
#define ERROR uError
- extern void uError(const char * /* s */ , ...
- )
-#if defined(__GNUC__) && \
- ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 6)))
- __attribute__ ((format(printf, 1, 2)))
-#endif
- ;
+extern __ATTR_PRINTF(1, 2) void
+uError(const char *s, ...);
#define FATAL uFatalError
- extern void uFatalError(const char * /* s */ , ...
- )
-#if defined(__GNUC__) && \
- ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 6)))
- __attribute__ ((format(printf, 1, 2)))
-#endif
- ;
+extern __ATTR_PRINTF(1, 2) void
+uFatalError(const char *s, ...);
/* WSGO stands for "Weird Stuff Going On" (wtf???) */
#define WSGO uInternalError
- extern void uInternalError(const char * /* s */ , ...
- )
-#if defined(__GNUC__) && \
- ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 6)))
- __attribute__ ((format(printf, 1, 2)))
-#endif
- ;
+extern __ATTR_PRINTF(1, 2) void
+uInternalError(const char *s, ...);
- extern void uSetPreErrorMessage(char * /* msg */
- );
+extern void
+uSetPreErrorMessage(char *msg);
- extern void uSetPostErrorMessage(char * /* msg */
- );
+extern void
+uSetPostErrorMessage(char *msg);
- extern void uSetErrorPrefix(char * /* void */
- );
+extern void
+uSetErrorPrefix(char *pre);
- extern void uFinishUp(void);
+extern void
+uFinishUp(void);
/***====================================================================***/
@@ -193,18 +169,16 @@ uInformation(const char * /* s */ , ...
#define uStrCaseCmp(s1,s2) (strcasecmp(s1,s2))
#define uStrCasePrefix(p,s) (strncasecmp(p,s,strlen(p))==0)
#else
- extern int uStrCaseCmp(const char * /* s1 */ ,
- const char * /* s2 */
- );
- extern int uStrCasePrefix(const char * /* p */ ,
- char * /* str */
- );
+extern int
+uStrCaseCmp(const char *s1, const char *s2);
+extern int
+uStrCasePrefix(const char *p, char *str);
#endif
#ifdef HAVE_STRDUP
#define uStringDup(s1) (strdup(s1))
#else
- extern char *uStringDup(const char * /* s1 */
- );
+extern char *
+uStringDup(const char *s);
#endif
/***====================================================================***/
@@ -222,31 +196,21 @@ uInformation(const char * /* s */ , ...
#define DEBUG_VAR debugFlags
#endif
-extern
- unsigned int DEBUG_VAR;
+extern unsigned int DEBUG_VAR;
- extern void uDebug(char * /* s */ , ...
- )
-#if defined(__GNUC__) && \
- ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 6)))
- __attribute__ ((format(printf, 1, 2)))
-#endif
- ;
+extern __ATTR_PRINTF(1, 2) void
+uDebug(char *s, ...);
- extern void uDebugNOI( /* no indent */
- char * /* s */ , ...
- )
-#if defined(__GNUC__) && \
- ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 6)))
- __attribute__ ((format(printf, 1, 2)))
-#endif
- ;
+extern __ATTR_PRINTF(1, 2) void
+uDebugNOI(char *s, ...);
- extern Boolean uSetDebugFile(char *name);
+extern Boolean
+uSetDebugFile(char *name);
+
+extern FILE *uDebugFile;
+extern int uDebugIndentLevel;
+extern int uDebugIndentSize;
- extern FILE *uDebugFile;
- extern int uDebugIndentLevel;
- extern int uDebugIndentSize;
#define uDebugIndent(l) (uDebugIndentLevel+=(l))
#define uDebugOutdent(l) (uDebugIndentLevel-=(l))
#ifdef DEBUG_ON
@@ -277,24 +241,22 @@ extern
#define uDEBUG_NOI5(f,s,a,b,c,d,e)
#endif
- extern Boolean uSetEntryFile(char *name);
- extern void uEntry(int /* l */ ,
- char * /* s */ , ...
- )
-#if defined(__GNUC__) && \
- ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 6)))
- __attribute__ ((format(printf, 2, 3)))
-#endif
- ;
+extern Boolean
+uSetEntryFile(char *name);
+
+extern __ATTR_PRINTF(2, 3) void
+uEntry(int l, char *s, ...);
+
+extern void
+uExit(int l, char *rtVal);
- extern void uExit(int l, char *rtVal);
#ifdef ENTRY_TRACKING_ON
#define ENTRY_BIT 0x10
#define LOW_ENTRY_BIT 0x1000
#define ENTER (DEBUG_VAR&ENTRY_BIT)
#define FLAG(fLag) (DEBUG_VAR&(fLag))
- extern int uEntryLevel;
+extern int uEntryLevel;
#define uENTRY(s) { if (ENTER) uEntry(1,s);}
#define uENTRY1(s,a) { if (ENTER) uEntry(1,s,a);}
@@ -341,5 +303,4 @@ extern
#define uFLAG_VOIDRETURN { return; }
#endif
-
#endif /* UTILS_H */