7 * DIGITAL EQUIPMENT CORPORATION
8 * MAYNARD, MASSACHUSETTS
11 * THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE AND
12 * SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT CORPORATION.
13 * DIGITAL MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE
14 * FOR ANY PURPOSE. IT IS SUPPLIED "AS IS" WITHOUT EXPRESS OR IMPLIED
17 * IF THE SOFTWARE IS MODIFIED IN A MANNER CREATING DERIVATIVE COPYRIGHT
18 * RIGHTS, APPROPRIATE LEGENDS MAY BE PLACED ON THE DERIVATIVE WORK IN
19 * ADDITION TO THAT SET FORTH ABOVE.
21 * Permission to use, copy, modify, and distribute this software and its
22 * documentation for any purpose and without fee is hereby granted, provided
23 * that the above copyright notice appear in all copies and that both that
24 * copyright notice and this permission notice appear in supporting
25 * documentation, and that the name of Digital Equipment Corporation not be
26 * used in advertising or publicity pertaining to distribution of the
27 * software without specific, written prior permission.
30 /***====================================================================***/
33 * We sometimes malloc strings and then expose them as const char*'s. This
34 * macro is used when we free these strings in order to avoid -Wcast-qual
37 #define UNCONSTIFY(const_ptr) ((void *) (uintptr_t) (const_ptr))
39 #define uDupString(s) ((s) ? strdup(s) : NULL)
40 #define uStringText(s) ((s) == NULL ? "<NullString>" : (s))
41 #define uStrCasePrefix(s1, s2) (strncasecmp((s1), (s2), strlen(s1)) == 0)
43 /* Compiler Attributes */
45 #if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(__CYGWIN__)
46 # define XKB_EXPORT __attribute__((visibility("default")))
47 #elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
48 # define XKB_EXPORT __global
49 #else /* not gcc >= 4 and not Sun Studio >= 8 */
53 #if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 203)
54 # define ATTR_PRINTF(x,y) __attribute__((__format__(__printf__, x, y)))
55 #else /* not gcc >= 2.3 */
56 # define ATTR_PRINTF(x,y)
59 #if (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 205)) \
60 || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
61 # define ATTR_NORETURN __attribute__((__noreturn__))
63 # define ATTR_NORETURN
66 #if (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 296)
67 #define ATTR_MALLOC __attribute__((__malloc__))
72 #define INFO(...) xkb_log(NULL, LOG_INFO, __VA_ARGS__)
73 #define WARN(...) xkb_log(NULL, LOG_WARNING, __VA_ARGS__)
74 #define ERROR(...) xkb_log(NULL, LOG_ERR, __VA_ARGS__)
75 #define WSGO(...) xkb_log(NULL, LOG_CRIT, __VA_ARGS__)
76 #define ACTION(...) xkb_log(NULL, -1, __VA_ARGS__)