This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug locale/19512] New: Stale `#ifndef HAVE_BUILTIN_EXPECT' in `intl/{gettextP,loadinfo}.h'


https://sourceware.org/bugzilla/show_bug.cgi?id=19512

            Bug ID: 19512
           Summary: Stale `#ifndef HAVE_BUILTIN_EXPECT' in
                    `intl/{gettextP,loadinfo}.h'
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: locale
          Assignee: unassigned at sourceware dot org
          Reporter: ilmalakhov at yandex dot ru
  Target Milestone: ---

Hi.

 The following stale code in intl/gettextP.h and intl/loadinfo.h

. . .
/* Tell the compiler when a conditional or integer expression is
   almost always true or almost always false.  */
#ifndef HAVE_BUILTIN_EXPECT
# define __builtin_expect(expr, val) (expr)
#endif
. . .

was probably unintentionally revived by commit
6d248857845aee307440a77062a93b167cd2ac9c when merging with gettext-0.19.3 after
it had been wiped out along with HAVE_BUILTIN_EXPECT macro by commit
3ce1f2959437e952b9db4eaeed2407424f11a4d1 more than three years before.

 As a result, when compiling a glibc source file which includes one of these
headers, for example, stdlib/strtod_l.c, `__builtin_expect's within it don't
actually take effect.  Depending on the host glibc is built for, this may lead
to a noticeable loss of productivity. I believe that the above files should
be patched once again:

diff --git a/intl/gettextP.h b/intl/gettextP.h
index a61e00f..8d96221 100644
--- a/intl/gettextP.h
+++ b/intl/gettextP.h
@@ -97,12 +97,6 @@ extern char *libintl_dcigettext (const char *__domainname,
 # define attribute_hidden
 #endif

-/* Tell the compiler when a conditional or integer expression is
-   almost always true or almost always false.  */
-#ifndef HAVE_BUILTIN_EXPECT
-# define __builtin_expect(expr, val) (expr)
-#endif
-
 #ifndef W
 # define W(flag, data) ((flag) ? SWAP (data) : (data))
 #endif
diff --git a/intl/loadinfo.h b/intl/loadinfo.h
index 91ab556..8a62b0a 100644
--- a/intl/loadinfo.h
+++ b/intl/loadinfo.h
@@ -38,12 +38,6 @@
 # define LIBINTL_DLL_EXPORTED
 #endif

-/* Tell the compiler when a conditional or integer expression is
-   almost always true or almost always false.  */
-#ifndef HAVE_BUILTIN_EXPECT
-# define __builtin_expect(expr, val) (expr)
-#endif
-
 /* Separator in PATH like lists of pathnames.  */
 #if ((defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__) || defined
__EMX__ || defined __DJGPP__
   /* Win32, OS/2, DOS */



 Beware of this problem in glibc-2.22 and glibc-2.21 as well as in master.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]