I hadn't thought about the possibility that the standard includes define __builtin_expect as a macro. I installed the attached; please give it a try.
From 50ba47004ee83c3a68d4416b8664117dc5e77eee Mon Sep 17 00:00:00 2001
From: Paul Eggert <egg...@cs.ucla.edu>
Date: Fri, 16 Dec 2016 16:47:26 -0800
Subject: [PATCH] builtin-expect: port to IBM XL C

Problem reported for z/OS by Daniel Richard G. in:
http://lists.gnu.org/archive/html/bug-gnulib/2016-12/msg00074.html
* m4/builtin-expect.m4 (gl___BUILTIN_EXPECT):
Also allow __builtin_expect defined via a standard include file.
---
 ChangeLog            | 6 ++++++
 m4/builtin-expect.m4 | 5 +++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index aba7199..2c44748 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2016-12-16  Paul Eggert  <egg...@cs.ucla.edu>
 
+	builtin-expect: port to IBM XL C
+	Problem reported for z/OS by Daniel Richard G. in:
+	http://lists.gnu.org/archive/html/bug-gnulib/2016-12/msg00074.html
+	* m4/builtin-expect.m4 (gl___BUILTIN_EXPECT):
+	Also allow __builtin_expect defined via a standard include file.
+
 	regex: fix dependency
 	Problem reported by Bruno Haible in:
 	http://lists.gnu.org/archive/html/bug-gnulib/2016-12/msg00073.html
diff --git a/m4/builtin-expect.m4 b/m4/builtin-expect.m4
index 5f7a323..ce048ae 100644
--- a/m4/builtin-expect.m4
+++ b/m4/builtin-expect.m4
@@ -12,7 +12,7 @@ AC_DEFUN([gl___BUILTIN_EXPECT],
   AC_CACHE_CHECK([for __builtin_expect],
     [gl_cv___builtin_expect],
     [AC_LINK_IFELSE(
-       [AC_LANG_SOURCE([[
+       [AC_LANG_SOURCE([AC_INCLUDES_DEFAULT[
          int
          main (int argc, char **argv)
          {
@@ -25,7 +25,8 @@ AC_DEFUN([gl___BUILTIN_EXPECT],
     AC_DEFINE([HAVE___BUILTIN_EXPECT], [1])
   fi
   AH_VERBATIM([HAVE___BUILTIN_EXPECT],
-    [/* Define to 1 if the compiler understands __builtin_expect.  */
+    [/* Define to 1 if the compiler or standard include files support
+   __builtin_expect.  */
 #undef HAVE___BUILTIN_EXPECT
 #ifndef HAVE___BUILTIN_EXPECT
 # define __builtin_expect(e, c) (e)
-- 
2.7.4

Reply via email to