Created attachment 59986 [details] [review]
While building xmodmap 1.0.6, I ran into this build error:
gcc -std=gnu99 -DHAVE_CONFIG_H -I. -Wall -Wpointer-arith -Wmissing-declarations -Wformat=2 -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wbad-function-cast -Wold-style-definition -Wdeclaration-after-statement -Wunused -Wuninitialized -Wshadow -Wcast-qual -Wmissing-noreturn -Wmissing-format-attribute -Wredundant-decls -Werror=implicit -Werror=nonnull -Werror=init-self -Werror=main -Werror=missing-braces -Werror=sequence-point -Werror=return-type -Werror=trigraphs -Werror=array-bounds -Werror=write-strings -Werror=address -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast -fno-strict-aliasing -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -c xmodmap.c
xmodmap.c: In function 'main':
xmodmap.c:247:5: error: implicit declaration of function 'asprintf' [-Werror=implicit-function-declaration]
xmodmap.c:247:5: warning: nested extern declaration of 'asprintf' [-Wnested-externs]
cc1: some warnings being treated as errors
As per asprintf man page:
#define _GNU_SOURCE /* See feature_test_macros(7) */
int asprintf(char **strp, const char *fmt, ...);
int vasprintf(char **strp, const char *fmt, va_list ap);
=> Adding #define _GNU_SOURCE fixes the build.
http://patchwork.freedesktop.org/patch/9923/ submitted for review
letting autoconf pick the right #define for the platform, since not
all of X.Org's supported platforms use/require _GNU_SOURCE for that.
Fix pushed to git master.
The committed fix didn't help, I still get the same error with xmodmap 1.0.7.
Created attachment 60482 [details] [review]
Seems like something is different with your build setup then, since no other
Linux user, nor the Linux tinderboxes, are reporting any such problem.
However, I do see there could be an ordering problem, as configure now
generates config.h to include:
/* Enable GNU extensions on systems that have them. */
# define _GNU_SOURCE 1
But xmodmap.c doesn't include config.h directly, instead gets it via
xmodmap.h which is loaded after stdio.h - the attached patch should
I'm not going to bother pushing/releasing this until you test & confirm
(In reply to comment #4)
> Created attachment 60482 [details] [review] [review]
I made a test build with this patch attached (and one more without):
- Without patch: fails (as expected)
- With patch: Build succeeds.
So from my PoV, this looks fine as a solution as well.
Thanks, fix pushed to git master.
on Oct 25, 2016 at 19:07:46.
(provided by the Example extension).