about summary refs log tree commit diff
path: root/misc/sys/sysmacros.h
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright dates with scripts/update-copyrights.Joseph Myers2017-01-011-1/+1
|
* [BZ #19239] Issue deprecation warnings on macro expansion.Zack Weinberg2016-11-141-33/+23
| | | | | | | | | | | | | | | | | | By using __glibc_macro_warning instead of __attribute_deprecated__, we get the deprecation warnings whenever the macros are expanded, not just when they compile to a function call. This is important for unintentional uses like the test case in #19239 (C++ var(value) initialization syntax, with a variable named "major"). It's also simpler, because __REDIRECT is no longer required. * misc/sys/sysmacros.h (__SYSMACROS_DM, __SYSMACROS_DM1): New macros. (__SYSMACROS_DEPRECATION_MSG, __SYSMACROS_FST_DECL_TEMPL) (__SYSMACROS_FST_IMPL_TEMPL): Delete. (major, minor, makedev): Use __SYSMACROS_DM in definition, instead of redirected function names. * misc/sys/cdefs.h (__glibc_macro_warning): Activate for clang >= 3.5 as well. Document that MESSAGE must be a single string literal.
* Deprecate inclusion of <sys/sysmacros.h> by <sys/types.h>Zack Weinberg2016-08-031-3/+59
| | | | | | | | | | | | | | | | | The macros defined by <sys/sysmacros.h> are not part of POSIX nor XSI, and their names frequently 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.
* Minimize sysdeps code involved in defining major/minor/makedev.Zack Weinberg2016-08-031-0/+64
Presently sys/sysmacros.h is entirely defined in sysdeps. This would mean that the deprecation logic coming up in the next patch 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 accommodates 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. (These symbols are in the user namespace, which is how they have always been on Linux. They begin with "gnu_dev_", so collisions with user code are pretty unlikely.) New ports henceforth need only provide a bits/sysmacros.h defining internal macros __SYSMACROS_{DECLARE,DEFINE}_{MAJOR,MINOR,MAKEDEV}. This is only necessary if the kernel encoding is incompatible with the now-generic encoding (for instance, it would be necessary for FreeBSD). While I was at it, I added a basic round-trip test for these functions. * sysdeps/generic/sys/sysmacros.h: Delete file. * sysdeps/unix/sysv/linux/makedev.c: Delete file. * sysdeps/unix/sysv/linux/sys/sysmacros.h: Move file ... * bits/sysmacros.h: ... here; this encoding is now the generic encoding. Now defines only the following macros: __SYSMACROS_DECLARE_MAJOR, __SYSMACROS_DEFINE_MAJOR, __SYSMACROS_DECLARE_MINOR, __SYSMACROS_DEFINE_MINOR, __SYSMACROS_DECLARE_MAKEDEV, __SYSMACROS_DEFINE_MAKEDEV. * misc/sys/sysmacros.h, misc/makedev.c: New files that use bits/sysmacros.h and the above new macros to generate the public implementations of major, minor, and makedev. * misc/tst-makedev.c: New test. * include/sys/sysmacros.h: New wrapper. * misc/Makefile (headers): Add sys/sysmacros.h, bits/sysmacros.h. (routines): Add makedev. (tests): Add tst-makedev. * misc/Versions [GLIBC_2.25]: 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.25, gnu_dev_major, gnu_dev_makedev, gnu_dev_minor. * sysdeps/unix/sysv/linux/aarch64/libc.abilist * sysdeps/unix/sysv/linux/alpha/libc.abilist * sysdeps/unix/sysv/linux/arm/libc.abilist * sysdeps/unix/sysv/linux/hppa/libc.abilist * sysdeps/unix/sysv/linux/i386/libc.abilist * sysdeps/unix/sysv/linux/ia64/libc.abilist * sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist * sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist * sysdeps/unix/sysv/linux/microblaze/libc.abilist * sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist * sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist * sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist * sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist * sysdeps/unix/sysv/linux/nios2/libc.abilist * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist * sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist * sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist * sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist * sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist * sysdeps/unix/sysv/linux/sh/libc.abilist * sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist * sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist * sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist * sysdeps/unix/sysv/linux/x86_64/64/libc.abilist * sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist: Add GLIBC_2.25.