[Groonga-commit] groonga/groonga at 09408c6 [master] Support clang again

Back to archive index

Kouhei Sutou null+****@clear*****
Wed Nov 23 15:19:19 JST 2016


Kouhei Sutou	2016-11-23 15:19:19 +0900 (Wed, 23 Nov 2016)

  New Revision: 09408c669556e669c938dfd495a45811a4c3a3d9
  https://github.com/groonga/groonga/commit/09408c669556e669c938dfd495a45811a4c3a3d9

  Message:
    Support clang again

  Modified files:
    include/groonga/groonga.h

  Modified: include/groonga/groonga.h (+10 -2)
===================================================================
--- include/groonga/groonga.h    2016-11-23 12:17:25 +0900 (bbeea9c)
+++ include/groonga/groonga.h    2016-11-23 15:19:19 +0900 (0c743ad)
@@ -1064,7 +1064,15 @@ GRN_API grn_log_level grn_logger_get_max_level(grn_ctx *ctx);
 # define GRN_ATTRIBUTE_PRINTF(fmt_pos)
 #endif /* __GNUC__ */
 
-#ifdef __GNUC__
+#if defined(__clang__)
+# if __has_attribute(__alloc_size__)
+#  define HAVE_ALLOC_SIZE_ATTRIBUTE
+# endif /* __has_attribute(__alloc_size__) */
+#elif defined(__GNUC__)
+# define HAVE_ALLOC_SIZE_ATTRIBUTE
+#endif /* __clang__ */
+
+#ifdef HAVE_ALLOC_SIZE_ATTRIBUTE
 # define GRN_ATTRIBUTE_ALLOC_SIZE(size) \
   __attribute__ ((alloc_size(size)))
 # define GRN_ATTRIBUTE_ALLOC_SIZE_N(n, size) \
@@ -1072,7 +1080,7 @@ GRN_API grn_log_level grn_logger_get_max_level(grn_ctx *ctx);
 #else
 # define GRN_ATTRIBUTE_ALLOC_SIZE(size)
 # define GRN_ATTRIBUTE_ALLOC_SIZE_N(n, size)
-#endif /* __GNUC__ */
+#endif /* HAVE_ALLOC_SIZE_ATTRIBUTE */
 
 GRN_API void grn_logger_put(grn_ctx *ctx, grn_log_level level,
                             const char *file, int line, const char *func, const char *fmt, ...) GRN_ATTRIBUTE_PRINTF(6);
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index