aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPaul Eggert2011-05-04 00:19:21 -0700
committerPaul Eggert2011-05-04 00:19:21 -0700
commitc378da0b47eb8c26fc8da4d89e128ee3c73537de (patch)
tree69780b09fd68c972f69c1414d48c84cb24a075fa /lib
parent288b08c747644d42c1636c2b469f8c34836ccd35 (diff)
downloademacs-c378da0b47eb8c26fc8da4d89e128ee3c73537de.tar.gz
emacs-c378da0b47eb8c26fc8da4d89e128ee3c73537de.zip
Use C99's va_copy to avoid undefined behavior on x86-64 GNU/Linux.
Diffstat (limited to 'lib')
-rw-r--r--lib/gnulib.mk29
-rw-r--r--lib/stdarg.in.h36
2 files changed, 64 insertions, 1 deletions
diff --git a/lib/gnulib.mk b/lib/gnulib.mk
index faf89aaa0e6..1466e430a4c 100644
--- a/lib/gnulib.mk
+++ b/lib/gnulib.mk
@@ -9,7 +9,7 @@
9# the same distribution terms as the rest of that program. 9# the same distribution terms as the rest of that program.
10# 10#
11# Generated by gnulib-tool. 11# Generated by gnulib-tool.
12# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files careadlinkat crypto/md5 dtoastr filemode getloadavg getopt-gnu ignore-value intprops lstat mktime readlink socklen stdio strftime strtoumax symlink sys_stat 12# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files careadlinkat crypto/md5 dtoastr filemode getloadavg getopt-gnu ignore-value intprops lstat mktime readlink socklen stdarg stdio strftime strtoumax symlink sys_stat
13 13
14 14
15MOSTLYCLEANFILES += core *.stackdump 15MOSTLYCLEANFILES += core *.stackdump
@@ -258,6 +258,33 @@ EXTRA_libgnu_a_SOURCES += stat.c
258 258
259## end gnulib module stat 259## end gnulib module stat
260 260
261## begin gnulib module stdarg
262
263BUILT_SOURCES += $(STDARG_H)
264
265# We need the following in order to create <stdarg.h> when the system
266# doesn't have one that works with the given compiler.
267if GL_GENERATE_STDARG_H
268stdarg.h: stdarg.in.h $(top_builddir)/config.status
269 $(AM_V_GEN)rm -f $@-t $@ && \
270 { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
271 sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
272 -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
273 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
274 -e 's|@''NEXT_STDARG_H''@|$(NEXT_STDARG_H)|g' \
275 < $(srcdir)/stdarg.in.h; \
276 } > $@-t && \
277 mv $@-t $@
278else
279stdarg.h: $(top_builddir)/config.status
280 rm -f $@
281endif
282MOSTLYCLEANFILES += stdarg.h stdarg.h-t
283
284EXTRA_DIST += stdarg.in.h
285
286## end gnulib module stdarg
287
261## begin gnulib module stdbool 288## begin gnulib module stdbool
262 289
263BUILT_SOURCES += $(STDBOOL_H) 290BUILT_SOURCES += $(STDBOOL_H)
diff --git a/lib/stdarg.in.h b/lib/stdarg.in.h
new file mode 100644
index 00000000000..4469d54e4f4
--- /dev/null
+++ b/lib/stdarg.in.h
@@ -0,0 +1,36 @@
1/* Substitute for and wrapper around <stdarg.h>.
2 Copyright (C) 2008-2011 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software Foundation,
16 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
17
18#ifndef _GL_STDARG_H
19
20#if __GNUC__ >= 3
21@PRAGMA_SYSTEM_HEADER@
22#endif
23@PRAGMA_COLUMNS@
24
25/* The include_next requires a split double-inclusion guard. */
26#@INCLUDE_NEXT@ @NEXT_STDARG_H@
27
28#ifndef _GL_STDARG_H
29#define _GL_STDARG_H
30
31#ifndef va_copy
32# define va_copy(a,b) ((a) = (b))
33#endif
34
35#endif /* _GL_STDARG_H */
36#endif /* _GL_STDARG_H */