diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/atomic.h | 2 | ||||
-rw-r--r-- | include/bits/xopen_lim.h | 2 | ||||
-rw-r--r-- | include/caller.h | 2 | ||||
-rw-r--r-- | include/errno.h | 2 | ||||
-rw-r--r-- | include/features.h | 4 | ||||
-rw-r--r-- | include/gnu-versions.h | 2 | ||||
-rw-r--r-- | include/gnu/libc-version.h | 2 | ||||
-rw-r--r-- | include/ifunc-impl-list.h | 2 | ||||
-rw-r--r-- | include/inline-hashtab.h | 2 | ||||
-rw-r--r-- | include/libc-symbols.h | 2 | ||||
-rw-r--r-- | include/limits.h | 2 | ||||
-rw-r--r-- | include/link.h | 2 | ||||
-rw-r--r-- | include/programs/xmalloc.h | 2 | ||||
-rw-r--r-- | include/rounding-mode.h | 2 | ||||
-rw-r--r-- | include/set-hooks.h | 2 | ||||
-rw-r--r-- | include/shlib-compat.h | 2 | ||||
-rw-r--r-- | include/stap-probe.h | 2 | ||||
-rw-r--r-- | include/stdc-predef.h | 2 | ||||
-rw-r--r-- | include/sys/time.h | 2 | ||||
-rw-r--r-- | include/values.h | 2 | ||||
-rw-r--r-- | include/verify.h | 140 |
21 files changed, 161 insertions, 21 deletions
diff --git a/include/atomic.h b/include/atomic.h index 92dbcc5dad..5a5319a582 100644 --- a/include/atomic.h +++ b/include/atomic.h @@ -1,5 +1,5 @@ /* Internal macros for atomic operations for GNU C Library. - Copyright (C) 2002-2013 Free Software Foundation, Inc. + Copyright (C) 2002-2014 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. diff --git a/include/bits/xopen_lim.h b/include/bits/xopen_lim.h index 6d85182e21..63fd1d8bb9 100644 --- a/include/bits/xopen_lim.h +++ b/include/bits/xopen_lim.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2013 Free Software Foundation, Inc. +/* Copyright (C) 1996-2014 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/include/caller.h b/include/caller.h index 8e2bb80b3d..7145fae56b 100644 --- a/include/caller.h +++ b/include/caller.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2013 Free Software Foundation, Inc. +/* Copyright (C) 2004-2014 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/include/errno.h b/include/errno.h index 8beb1b81ba..aae94de296 100644 --- a/include/errno.h +++ b/include/errno.h @@ -21,7 +21,7 @@ extern int rtld_errno attribute_hidden; # include <tls.h> -# if !defined __GNU__ +# if !(defined __GNU__ && defined IS_IN_rtld) # undef errno # ifndef NOT_IN_libc # define errno __libc_errno diff --git a/include/features.h b/include/features.h index 6acd5c899d..21173a28c3 100644 --- a/include/features.h +++ b/include/features.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2013 Free Software Foundation, Inc. +/* Copyright (C) 1991-2014 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -367,7 +367,7 @@ /* Major and minor version number of the GNU C library package. Use these macros to test for features in specific releases. */ #define __GLIBC__ 2 -#define __GLIBC_MINOR__ 18 +#define __GLIBC_MINOR__ 19 #define __GLIBC_PREREQ(maj, min) \ ((__GLIBC__ << 16) + __GLIBC_MINOR__ >= ((maj) << 16) + (min)) diff --git a/include/gnu-versions.h b/include/gnu-versions.h index 928c889736..6ffbd4716e 100644 --- a/include/gnu-versions.h +++ b/include/gnu-versions.h @@ -1,5 +1,5 @@ /* Header with interface version macros for library pieces copied elsewhere. - Copyright (C) 1995-2013 Free Software Foundation, Inc. + Copyright (C) 1995-2014 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/include/gnu/libc-version.h b/include/gnu/libc-version.h index 6d55f88ee4..b2d32e12e4 100644 --- a/include/gnu/libc-version.h +++ b/include/gnu/libc-version.h @@ -1,5 +1,5 @@ /* Interface to GNU libc specific functions for version information. - Copyright (C) 1998-2013 Free Software Foundation, Inc. + Copyright (C) 1998-2014 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/include/ifunc-impl-list.h b/include/ifunc-impl-list.h index 652a07a09a..149bac9268 100644 --- a/include/ifunc-impl-list.h +++ b/include/ifunc-impl-list.h @@ -1,5 +1,5 @@ /* Internal header file for __libc_supported_implementations. - Copyright (C) 2012-2013 Free Software Foundation, Inc. + Copyright (C) 2012-2014 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/include/inline-hashtab.h b/include/inline-hashtab.h index 863b377b5c..e84a02bb67 100644 --- a/include/inline-hashtab.h +++ b/include/inline-hashtab.h @@ -1,5 +1,5 @@ /* Fully-inline hash table, used mainly for managing TLS descriptors. - Copyright (C) 1999-2013 Free Software Foundation, Inc. + Copyright (C) 1999-2014 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Alexandre Oliva <aoliva@redhat.com> diff --git a/include/libc-symbols.h b/include/libc-symbols.h index e7c778e394..4b233be0bd 100644 --- a/include/libc-symbols.h +++ b/include/libc-symbols.h @@ -1,6 +1,6 @@ /* Support macros for making weak and strong aliases for symbols, and for using symbol sets and linker warnings with GNU ld. - Copyright (C) 1995-2013 Free Software Foundation, Inc. + Copyright (C) 1995-2014 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/include/limits.h b/include/limits.h index 816fb682ed..311386a23b 100644 --- a/include/limits.h +++ b/include/limits.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2013 Free Software Foundation, Inc. +/* Copyright (C) 1991-2014 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/include/link.h b/include/link.h index 1682467631..670d40157b 100644 --- a/include/link.h +++ b/include/link.h @@ -1,6 +1,6 @@ /* Data structure for communication from the run-time dynamic linker for loaded ELF shared objects. - Copyright (C) 1995-2013 Free Software Foundation, Inc. + Copyright (C) 1995-2014 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/include/programs/xmalloc.h b/include/programs/xmalloc.h index f4278852be..9ef486fcb9 100644 --- a/include/programs/xmalloc.h +++ b/include/programs/xmalloc.h @@ -1,5 +1,5 @@ /* Memory related definitions for program modules. - Copyright (C) 1998-2013 Free Software Foundation, Inc. + Copyright (C) 1998-2014 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software; you can redistribute it and/or modify diff --git a/include/rounding-mode.h b/include/rounding-mode.h index c765551979..9a048c7857 100644 --- a/include/rounding-mode.h +++ b/include/rounding-mode.h @@ -1,5 +1,5 @@ /* Handle floating-point rounding mode within libc. - Copyright (C) 2012-2013 Free Software Foundation, Inc. + Copyright (C) 2012-2014 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/include/set-hooks.h b/include/set-hooks.h index e58f444d42..85bd771d25 100644 --- a/include/set-hooks.h +++ b/include/set-hooks.h @@ -1,5 +1,5 @@ /* Macros for using symbol sets for running lists of functions. - Copyright (C) 1994-2013 Free Software Foundation, Inc. + Copyright (C) 1994-2014 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/include/shlib-compat.h b/include/shlib-compat.h index 955c6aeea2..fac0814bc2 100644 --- a/include/shlib-compat.h +++ b/include/shlib-compat.h @@ -1,5 +1,5 @@ /* Macros for managing ABI-compatibility definitions using ELF symbol versions. - Copyright (C) 2000-2013 Free Software Foundation, Inc. + Copyright (C) 2000-2014 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/include/stap-probe.h b/include/stap-probe.h index e2963506aa..73b88e67ee 100644 --- a/include/stap-probe.h +++ b/include/stap-probe.h @@ -1,5 +1,5 @@ /* Macros for defining Systemtap <sys/sdt.h> static probe points. - Copyright (C) 2012-2013 Free Software Foundation, Inc. + Copyright (C) 2012-2014 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/include/stdc-predef.h b/include/stdc-predef.h index f8cb2cb97a..87e3666502 100644 --- a/include/stdc-predef.h +++ b/include/stdc-predef.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2013 Free Software Foundation, Inc. +/* Copyright (C) 1991-2014 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/include/sys/time.h b/include/sys/time.h index b9af6d480f..d2c628e987 100644 --- a/include/sys/time.h +++ b/include/sys/time.h @@ -1,5 +1,5 @@ /* Time function internal interfaces. - Copyright (C) 1997-2013 Free Software Foundation, Inc. + Copyright (C) 1997-2014 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/include/values.h b/include/values.h index d31cf72ae1..24b1fe6505 100644 --- a/include/values.h +++ b/include/values.h @@ -1,5 +1,5 @@ /* Old compatibility names for <limits.h> and <float.h> constants. - Copyright (C) 1995-2013 Free Software Foundation, Inc. + Copyright (C) 1995-2014 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/include/verify.h b/include/verify.h new file mode 100644 index 0000000000..34705007d2 --- /dev/null +++ b/include/verify.h @@ -0,0 +1,140 @@ +/* Compile-time assert-like macros. + + Copyright (C) 2005-2015 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */ + +#ifndef VERIFY_H +# define VERIFY_H 1 + +/* Each of these macros verifies that its argument R is nonzero. To + be portable, R should be an integer constant expression. Unlike + assert (R), there is no run-time overhead. + + There are two macros, since no single macro can be used in all + contexts in C. verify_true (R) is for scalar contexts, including + integer constant expression contexts. verify (R) is for declaration + contexts, e.g., the top level. + + Symbols ending in "__" are private to this header. + + The code below uses several ideas. + + * The first step is ((R) ? 1 : -1). Given an expression R, of + integral or boolean or floating-point type, this yields an + expression of integral type, whose value is later verified to be + constant and nonnegative. + + * Next this expression W is wrapped in a type + struct verify_type__ { unsigned int verify_error_if_negative_size__: W; }. + If W is negative, this yields a compile-time error. No compiler can + deal with a bit-field of negative size. + + One might think that an array size check would have the same + effect, that is, that the type struct { unsigned int dummy[W]; } + would work as well. However, inside a function, some compilers + (such as C++ compilers and GNU C) allow local parameters and + variables inside array size expressions. With these compilers, + an array size check would not properly diagnose this misuse of + the verify macro: + + void function (int n) { verify (n < 0); } + + * For the verify macro, the struct verify_type__ will need to + somehow be embedded into a declaration. To be portable, this + declaration must declare an object, a constant, a function, or a + typedef name. If the declared entity uses the type directly, + such as in + + struct dummy {...}; + typedef struct {...} dummy; + extern struct {...} *dummy; + extern void dummy (struct {...} *); + extern struct {...} *dummy (void); + + two uses of the verify macro would yield colliding declarations + if the entity names are not disambiguated. A workaround is to + attach the current line number to the entity name: + + #define GL_CONCAT0(x, y) x##y + #define GL_CONCAT(x, y) GL_CONCAT0 (x, y) + extern struct {...} * GL_CONCAT(dummy,__LINE__); + + But this has the problem that two invocations of verify from + within the same macro would collide, since the __LINE__ value + would be the same for both invocations. + + A solution is to use the sizeof operator. It yields a number, + getting rid of the identity of the type. Declarations like + + extern int dummy [sizeof (struct {...})]; + extern void dummy (int [sizeof (struct {...})]); + extern int (*dummy (void)) [sizeof (struct {...})]; + + can be repeated. + + * Should the implementation use a named struct or an unnamed struct? + Which of the following alternatives can be used? + + extern int dummy [sizeof (struct {...})]; + extern int dummy [sizeof (struct verify_type__ {...})]; + extern void dummy (int [sizeof (struct {...})]); + extern void dummy (int [sizeof (struct verify_type__ {...})]); + extern int (*dummy (void)) [sizeof (struct {...})]; + extern int (*dummy (void)) [sizeof (struct verify_type__ {...})]; + + In the second and sixth case, the struct type is exported to the + outer scope; two such declarations therefore collide. GCC warns + about the first, third, and fourth cases. So the only remaining + possibility is the fifth case: + + extern int (*dummy (void)) [sizeof (struct {...})]; + + * This implementation exploits the fact that GCC does not warn about + the last declaration mentioned above. If a future version of GCC + introduces a warning for this, the problem could be worked around + by using code specialized to GCC, e.g.,: + + #if 4 <= __GNUC__ + # define verify(R) \ + extern int (* verify_function__ (void)) \ + [__builtin_constant_p (R) && (R) ? 1 : -1] + #endif + + * In C++, any struct definition inside sizeof is invalid. + Use a template type to work around the problem. */ + + +/* Verify requirement R at compile-time, as an integer constant expression. + Return 1. */ + +# ifdef __cplusplus +template <int w> + struct verify_type__ { unsigned int verify_error_if_negative_size__: w; }; +# define verify_true(R) \ + (!!sizeof (verify_type__<(R) ? 1 : -1>)) +# else +# define verify_true(R) \ + (!!sizeof \ + (struct { unsigned int verify_error_if_negative_size__: (R) ? 1 : -1; })) +# endif + +/* Verify requirement R at compile-time, as a declaration without a + trailing ';'. */ + +# define verify(R) extern int (* verify_function__ (void)) [verify_true (R)] + +#endif |