CVE-2015-5330: next_codepoint_handle_ext: don't short-circuit UTF16 low bytes
[samba.git] / lib / util / attr.h
index f64b272a674e12b44916b5eda69df06238cd5a99..b72696a8dc3c8ca515d273b3cc8683c617fa409d 100644 (file)
 #ifndef __UTIL_ATTR_H__
 #define __UTIL_ATTR_H__
 
+#ifndef _UNUSED_
 #ifdef __GNUC__
 /** gcc attribute used on function parameters so that it does not emit
  * warnings about them being unused. **/
-#  define UNUSED(param) param __attribute__ ((unused))
+#  define _UNUSED_ __attribute__ ((unused))
 #else
-#  define UNUSED(param) param
+#  define _UNUSED_
 /** Feel free to add definitions for other compilers here. */
 #endif
-
-#ifdef HAVE_VISIBILITY_ATTR
-#  define _PUBLIC_ __attribute__((visibility("default")))
-#else
-#  define _PUBLIC_
+#endif
+#ifndef UNUSED
+#define UNUSED(param) param _UNUSED_
 #endif
 
 #ifndef _DEPRECATED_
 #endif
 #endif
 
+#ifndef FORMAT_ATTRIBUTE
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
+/** Use gcc attribute to check printf fns.  a1 is argument to format()
+ * in the above macro.  This is needed to support Heimdal's printf
+ * decorations. Note that some gcc 2.x versions don't handle this
+ * properly, and as such I've used the same minimum from heimdal: GCC 3.1 **/
+#define FORMAT_ATTRIBUTE(a) __attribute__ ((format a))
+#else
+#define FORMAT_ATTRIBUTE(a)
+#endif
+#endif
+
 #endif /* __UTIL_ATTR_H__ */