Mercurial > hg > octave-kai > gnulib-hg
annotate lib/xvasprintf.h @ 14350:4cf3b58aaf12
Don't interfere with a program's definition of __attribute__.
* lib/argp.h (__attribute__): Remove definition.
(_GL_ATTRIBUTE_FORMAT): New macro.
(argp_error, __argp_error, argp_failure, __argp_failure): Use it.
* lib/argp-fmtstream.h (__attribute__): Remove definition.
(_GL_ATTRIBUTE_FORMAT): New macro.
(__argp_fmtstream_printf, argp_fmtstream_printf): Use it.
* lib/argp-help.c (hol_entry_long_iterate): Use __attribute__ only for
GCC 3 or newer.
* lib/error.h (__attribute__): Remove definition.
(_GL_ATTRIBUTE_FORMAT): New macro.
(error, error_at_line): Use it.
* lib/hash.h (__attribute__): Remove definition.
(ATTRIBUTE_WUR): Update definition. Define always.
* lib/openat.h (__attribute__): Remove definition.
(ATTRIBUTE_NORETURN): Update definition. Define always.
* lib/sigpipe-die.h (__attribute__): Remove definition.
(ATTRIBUTE_NORETURN): Update definition. Define always.
* lib/vasnprintf.h (__attribute__): Remove definition.
(_GL_ATTRIBUTE_FORMAT): New macro.
(asnprintf, vasnprintf): Use it.
* lib/xalloc.h (__attribute__): Remove definition.
(ATTRIBUTE_NORETURN): Update definition. Define always.
(ATTRIBUTE_MALLOC, ATTRIBUTE_ALLOC_SIZE): Define always.
* lib/xmemdup0.h (__attribute__): Remove definition.
(ATTRIBUTE_NORETURN): Update definition. Define always.
* lib/xprintf.h (__attribute__): Remove definition.
(_GL_ATTRIBUTE_FORMAT): New macro.
(xprintf, xvprintf, xfprintf, xvfprintf): Use it.
* lib/xstrtol.h (__attribute__): Remove definition.
(ATTRIBUTE_NORETURN): Update definition. Define always.
* lib/xvasprintf.h (__attribute__): Remove definition.
(_GL_ATTRIBUTE_FORMAT): New macro.
(xasprintf, xvasprintf): Use it.
* tests/test-argmatch.c (__attribute__): Remove definition.
(ATTRIBUTE_NORETURN): Update definition. Define always.
* tests/test-exclude.c (__attribute__): Remove definition.
(ATTRIBUTE_NORETURN): Update definition. Define always.
Reported by Paul Eggert.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sun, 13 Feb 2011 23:21:20 +0100 |
parents | 97fc9a21a8fb |
children | 8250f2777afc |
rev | line source |
---|---|
5218 | 1 /* vasprintf and asprintf with out-of-memory checking. |
14079
97fc9a21a8fb
maint: update almost all copyright ranges to include 2011
Jim Meyering <meyering@redhat.com>
parents:
12762
diff
changeset
|
2 Copyright (C) 2002-2004, 2006-2011 Free Software Foundation, Inc. |
5218 | 3 |
9309
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
8386
diff
changeset
|
4 This program is free software: you can redistribute it and/or modify |
5218 | 5 it under the terms of the GNU General Public License as published by |
9309
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
8386
diff
changeset
|
6 the Free Software Foundation; either version 3 of the License, or |
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
8386
diff
changeset
|
7 (at your option) any later version. |
5218 | 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 | |
9309
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
8386
diff
changeset
|
14 You should have received a copy of the GNU General Public License |
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
8386
diff
changeset
|
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
5218 | 16 |
17 #ifndef _XVASPRINTF_H | |
18 #define _XVASPRINTF_H | |
19 | |
20 /* Get va_list. */ | |
21 #include <stdarg.h> | |
22 | |
12762
410eaa89fb57
Avoid a link error due to the __printf__ symbol.
Bruno Haible <bruno@clisp.org>
parents:
12559
diff
changeset
|
23 /* The __attribute__ feature is available in gcc versions 2.5 and later. |
410eaa89fb57
Avoid a link error due to the __printf__ symbol.
Bruno Haible <bruno@clisp.org>
parents:
12559
diff
changeset
|
24 The __-protected variants of the attributes 'format' and 'printf' are |
410eaa89fb57
Avoid a link error due to the __printf__ symbol.
Bruno Haible <bruno@clisp.org>
parents:
12559
diff
changeset
|
25 accepted by gcc versions 2.6.4 (effectively 2.7) and later. |
14350
4cf3b58aaf12
Don't interfere with a program's definition of __attribute__.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
26 We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because |
12762
410eaa89fb57
Avoid a link error due to the __printf__ symbol.
Bruno Haible <bruno@clisp.org>
parents:
12559
diff
changeset
|
27 gnulib and libintl do '#define printf __printf__' when they override |
410eaa89fb57
Avoid a link error due to the __printf__ symbol.
Bruno Haible <bruno@clisp.org>
parents:
12559
diff
changeset
|
28 the 'printf' function. */ |
14350
4cf3b58aaf12
Don't interfere with a program's definition of __attribute__.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
29 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) |
4cf3b58aaf12
Don't interfere with a program's definition of __attribute__.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
30 # define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec)) |
4cf3b58aaf12
Don't interfere with a program's definition of __attribute__.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
31 #else |
4cf3b58aaf12
Don't interfere with a program's definition of __attribute__.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
32 # define _GL_ATTRIBUTE_FORMAT(spec) /* empty */ |
5218 | 33 #endif |
34 | |
8386
4ec84f742938
Convert tabs in the middle of preprocessor directives.
Bruno Haible <bruno@clisp.org>
parents:
6880
diff
changeset
|
35 #ifdef __cplusplus |
5218 | 36 extern "C" { |
37 #endif | |
38 | |
6880 | 39 /* Write formatted output to a string dynamically allocated with malloc(), |
40 and return it. Upon [ENOMEM] memory allocation error, call xalloc_die. | |
5218 | 41 On some other error |
42 - [EOVERFLOW] resulting string length is > INT_MAX, | |
43 - [EINVAL] invalid format string, | |
44 - [EILSEQ] error during conversion between wide and multibyte characters, | |
45 return NULL. */ | |
46 extern char *xasprintf (const char *format, ...) | |
14350
4cf3b58aaf12
Don't interfere with a program's definition of __attribute__.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
47 _GL_ATTRIBUTE_FORMAT ((__printf__, 1, 2)); |
5218 | 48 extern char *xvasprintf (const char *format, va_list args) |
14350
4cf3b58aaf12
Don't interfere with a program's definition of __attribute__.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
49 _GL_ATTRIBUTE_FORMAT ((__printf__, 1, 0)); |
5218 | 50 |
8386
4ec84f742938
Convert tabs in the middle of preprocessor directives.
Bruno Haible <bruno@clisp.org>
parents:
6880
diff
changeset
|
51 #ifdef __cplusplus |
5218 | 52 } |
53 #endif | |
54 | |
55 #endif /* _XVASPRINTF_H */ |