Bug #4555
closedmacro side-effects with /usr/include/libelf.h
100%
Description
libelf.h contains the following snippet:
#undef _ #ifdef __STDC__ typedef void Elf_Void; #define _(a) a #else typedef char Elf_Void; #define _(a) () #undef const #define const #endif
(at the end, '_' is #undef'd)
This causes interference with other programs defining the macro '_', for example for NLS purposes. 'const' is may also be redefined...
A possible solution is to use #pragma push_macro/pop_macro but that would seemingly restrict builds to gcc>=4.4 and recent clang.
BTW, a current workaround is to put #pragma push_macro("_") and pop_macro("_")
around #include <gelf.h> or #include <libelf.h> statements.
Other ELF distros defining libelf.h don't have this problem.
Files
Updated by Richard PALO almost 10 years ago
- File 0001-4555-fix-side-effects-of-macro-redefinitions-in-libe.patch 0001-4555-fix-side-effects-of-macro-redefinitions-in-libe.patch added
After reviewing the manner other illumos components avoided the above side-effects,
the attached patch seems appropriate.
Updated by Andrew Stormont almost 10 years ago
Patch looks good to me. Feel free to count me as a reviewer.
Updated by Igor Pashev almost 10 years ago
Why not just remove support for pre-ANSI C with those macros ?
Updated by Richard PALO over 9 years ago
- File 0001-4555-remove-_STDC-conditionals-from-libelf.h-fixing-.patch 0001-4555-remove-_STDC-conditionals-from-libelf.h-fixing-.patch added
As the prevalent opinion was to drop the non STDC stuff, attached is a reworked patch.
I've so far done a successful incremental, and am proceeding to pull and rebase illumos-gate for a full build.
Updated by Richard PALO over 9 years ago
- File 0001-4555-remove-STDC-conditionals-from-libelf.h-fixing-s.patch 0001-4555-remove-STDC-conditionals-from-libelf.h-fixing-s.patch added
no time like the present to relook, making libelf.h cstyle clean.
Another go...
Updated by Richard PALO over 9 years ago
Updated by Dan McDonald over 9 years ago
- Status changed from New to Resolved
See update from the git robot.
Updated by Electric Monk over 9 years ago
git commit 7a3fc0ccaf807a654980fdce2d9187503628b99d
Author: Richard PALO <richard@NetBSD.org> 4555 macro side-effects with /usr/include/libelf.h Reviewed by: Richard Lowe <richlowe@richlowe.net> Reviewed by: Andy Stormont <AStormont@racktopsystems.com> Reviewed by: Igor Pashev <pashev.igor@gmail.com> Approved by: Dan McDonald <danmcd@omniti.com>
Updated by Yuri Pankov over 9 years ago
- Category set to lib - userland libraries
- Assignee set to Richard PALO
- % Done changed from 0 to 100
- Tags deleted (
needs-triage)