This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/19239] Including stdlib.h ends up with macros major and minor being defined
- From: "cvs-commit at gcc dot gnu.org" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Fri, 08 Jul 2016 17:02:39 +0000
- Subject: [Bug libc/19239] Including stdlib.h ends up with macros major and minor being defined
- Auto-submitted: auto-generated
- References: <bug-19239-131@http.sourceware.org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=19239
--- Comment #4 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, azanella/deprecate-makedev has been created
at 58dc3371865ef8e331de33423c57af855f6b6c45 (commit)
- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=58dc3371865ef8e331de33423c57af855f6b6c45
commit 58dc3371865ef8e331de33423c57af855f6b6c45
Author: Zack Weinberg <zackw@panix.com>
Date: Thu Jul 7 17:10:02 2016 -0300
Deprecate inclusion of <sys/sysmacros.h> by <sys/types.h>
The macros defined by <sys/sysmacros.h> are not part of POSIX nor XSI,
and their names have been found frequently to collide with user code;
see for instance glibc bug 19239 and Red Hat bug 130601. <stdlib.h>
includes <sys/types.h> under _GNU_SOURCE, and C++ code presently cannot
avoid being compiled under _GNU_SOURCE, exacerbating the problem.
* NEWS: Inclusion of <sys/sysmacros.h> by <sys/types.h> is deprecated.
* misc/sys/sysmacros.h: If __SYSMACROS_DEPRECATED_INCLUSION is defined,
define major, minor, and makedev to issue deprecation warnings on use.
If __SYSMACROS_DEPRECATED_INCLUSION is *not* defined, suppress
previously-activated deprecation warnings for these macros and prevent
subsequent inclusions of this header from having any effect.
* posix/sys/types.h: Define __SYSMACROS_DEPRECATED_INCLUSION before
including <sys/sysmacros.h>, and undefine it again afterward.
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=c304e8024e39c68fdbaa2681855f1e0af0a48659
commit c304e8024e39c68fdbaa2681855f1e0af0a48659
Author: Zack Weinberg <zackw@panix.com>
Date: Thu Jul 7 17:07:09 2016 -0300
Add utility macros for clang detection, and deprecation with messages
Add three new macros to features.h and sys/cdefs.h:
* __glibc_clang_prereq: just like __GNUC_PREREQ, but for clang.
* __glibc_clang_has_extension: wraps clang's intrinsic __has_extension.
Writing "#if defined __clang__ && __has_extension (...)" doesn't work,
because compilers other than clang will object to the unknown macro
__has_extension even though they don't need to evaluate it.
Instead, write "#if __glibc_clang_has_extension (...)".
* __attribute_deprecated_msg__(msg): like __attribute_deprecated__, but
if possible, prints a message.
* include/features.h (__glibc_clang_prereq): New macro.
* misc/sys/cdefs.h (__glibc_clang_has_extension)
(__attribute_deprecated_msg__): New macros.
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=050bc98376edd26429cff885c339c53f30224aa7
commit 050bc98376edd26429cff885c339c53f30224aa7
Author: Zack Weinberg <zackw@panix.com>
Date: Thu Jul 7 16:00:45 2016 -0300
Minimize sysdeps code involved in defining major/minor/makedev
Presently sys/sysmacros.h is entirely defined in sysdeps. This would
mean that the deprecation logic coming up in patch #4 would have to be
written twice (in generic/ and unix/sysv/linux/). To avoid that, hoist
all but the unavoidably system-dependent logic to misc/, leaving a bits/
header behind. This also promotes the Linux-specific encoding of dev_t,
which accommodated 32-bit major and minor numbers in a 64-bit dev_t,
to generic, as glibc's dev_t is always 64 bits wide.
The former Linux implementation used inline functions to avoid evaluating
arguments more than once. After this change, all platforms use inline
functions, which means that three new symbols are added to the generic ABI.
New ports henceforth need only provide bits/sysmacros.h defining macros
__makedev_body, __major_body, and __minor_body.
While I was at it, I added a basic round-trip test for these functions.
Tested on x86_64, i686, x32, aarch64, armhf, powerpc64le, s390x, and
s390.
* misc/sys/sysmacros.h: New file with generic inline-function-based
implementation of major, minor, makedev, derived from the old
sysdeps/unix/sysv/linux/sys/sysmacros.h.
* include/sys/sysmacros.h: New wrapper.
* sysdeps/unix/sysv/linux/sys/sysmacros.h: Move ...
* bits/sysmacros.h: ... here; only define __makedev_body,
__major_body, __minor_body.
* sysdeps/generic/sys/sysmacros.h: Deleted.
* sysdeps/unix/sysv/linux/makedev.c: Move ...
* misc/makedev.c: ... here; make generic.
* misc/tst-makedev.c: New test.
* misc/Makefile (headers): Add sys/sysmacros.h, bits/sysmacros.h.
(routines): Add makedev.
(tests): Add tst-makedev.
* misc/Versions [GLIBC_2.24]: Add gnu_dev_major, gnu_dev_minor,
gnu_dev_makedev.
* posix/Makefile (headers): Remove sys/sysmacros.h.
* sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Remove makedev.
* sysdeps/arm/nacl/libc.abilist: Add GLIBC_2.24,
gnu_dev_major, gnu_dev_makedev, gnu_dev_minor.
-----------------------------------------------------------------------
--
You are receiving this mail because:
You are on the CC list for the bug.