mirror of
https://https.git.savannah.gnu.org/git/gnulib.git
synced 2026-05-13 15:13:36 +00:00
use _GL_ATTRIBUTE_CONST and _GL_ATTRIBUTE_PURE
This commit is contained in:
@@ -57,6 +57,14 @@
|
||||
ARGMATCH_DIE_DECL;
|
||||
#endif
|
||||
|
||||
/* The attribute __pure__ was added in gcc 2.96. */
|
||||
#undef _GL_ATTRIBUTE_PURE
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
|
||||
# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
|
||||
#else
|
||||
# define _GL_ATTRIBUTE_PURE /* empty */
|
||||
#endif
|
||||
|
||||
static void
|
||||
__argmatch_die (void)
|
||||
{
|
||||
@@ -79,7 +87,7 @@ argmatch_exit_fn argmatch_die = __argmatch_die;
|
||||
"no", "nope" -> 1
|
||||
"y" is a valid argument, for `0', and "n" for `1'. */
|
||||
|
||||
ptrdiff_t
|
||||
ptrdiff_t _GL_ATTRIBUTE_PURE
|
||||
argmatch (const char *arg, const char *const *arglist,
|
||||
const char *vallist, size_t valsize)
|
||||
{
|
||||
|
||||
@@ -22,6 +22,14 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
/* The attribute __pure__ was added in gcc 2.96. */
|
||||
#undef _GL_ATTRIBUTE_PURE
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
|
||||
# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
|
||||
#else
|
||||
# define _GL_ATTRIBUTE_PURE /* empty */
|
||||
#endif
|
||||
|
||||
struct argv_iterator
|
||||
{
|
||||
/* Test FP to determine whether in read-mode or argv-mode. */
|
||||
@@ -96,7 +104,7 @@ argv_iter (struct argv_iterator *ai, enum argv_iter_err *err)
|
||||
}
|
||||
}
|
||||
|
||||
size_t
|
||||
size_t _GL_ATTRIBUTE_PURE
|
||||
argv_iter_n_args (struct argv_iterator const *ai)
|
||||
{
|
||||
return ai->fp ? ai->item_idx : ai->p - ai->arg_list;
|
||||
|
||||
10
lib/base64.c
10
lib/base64.c
@@ -53,6 +53,14 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/* The attribute __const__ was added in gcc 2.95. */
|
||||
#undef _GL_ATTRIBUTE_CONST
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
|
||||
# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__))
|
||||
#else
|
||||
# define _GL_ATTRIBUTE_CONST /* empty */
|
||||
#endif
|
||||
|
||||
/* C89 compliant way to cast 'char' to 'unsigned char'. */
|
||||
static inline unsigned char
|
||||
to_uchar (char ch)
|
||||
@@ -295,7 +303,7 @@ static const signed char b64[0x100] = {
|
||||
/* Return true if CH is a character from the Base64 alphabet, and
|
||||
false otherwise. Note that '=' is padding and not considered to be
|
||||
part of the alphabet. */
|
||||
bool
|
||||
bool _GL_ATTRIBUTE_CONST
|
||||
isbase64 (char ch)
|
||||
{
|
||||
return uchar_in_range (to_uchar (ch)) && 0 <= b64[to_uchar (ch)];
|
||||
|
||||
@@ -22,11 +22,19 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/* The attribute __pure__ was added in gcc 2.96. */
|
||||
#undef _GL_ATTRIBUTE_PURE
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
|
||||
# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
|
||||
#else
|
||||
# define _GL_ATTRIBUTE_PURE /* empty */
|
||||
#endif
|
||||
|
||||
/* Return the address of the last file name component of NAME. If
|
||||
NAME has no relative file name components because it is a file
|
||||
system root, return the empty string. */
|
||||
|
||||
char *
|
||||
char * _GL_ATTRIBUTE_PURE
|
||||
last_component (char const *name)
|
||||
{
|
||||
char const *base = name + FILE_SYSTEM_PREFIX_LEN (name);
|
||||
|
||||
@@ -22,9 +22,17 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
#define NO_C_CTYPE_MACROS
|
||||
#include "c-ctype.h"
|
||||
|
||||
/* The attribute __const__ was added in gcc 2.95. */
|
||||
#undef _GL_ATTRIBUTE_CONST
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
|
||||
# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__))
|
||||
#else
|
||||
# define _GL_ATTRIBUTE_CONST /* empty */
|
||||
#endif
|
||||
|
||||
/* The function isascii is not locale dependent. Its use in EBCDIC is
|
||||
questionable. */
|
||||
bool
|
||||
bool _GL_ATTRIBUTE_CONST
|
||||
c_isascii (int c)
|
||||
{
|
||||
return (c >= 0x00 && c <= 0x7f);
|
||||
|
||||
@@ -24,7 +24,15 @@
|
||||
|
||||
#include "c-ctype.h"
|
||||
|
||||
int
|
||||
/* The attribute __pure__ was added in gcc 2.96. */
|
||||
#undef _GL_ATTRIBUTE_PURE
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
|
||||
# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
|
||||
#else
|
||||
# define _GL_ATTRIBUTE_PURE /* empty */
|
||||
#endif
|
||||
|
||||
int _GL_ATTRIBUTE_PURE
|
||||
c_strncasecmp (const char *s1, const char *s2, size_t n)
|
||||
{
|
||||
register const unsigned char *p1 = (const unsigned char *) s1;
|
||||
|
||||
@@ -32,6 +32,14 @@
|
||||
# error "compile this file only if your system defines PATH_MAX"
|
||||
#endif
|
||||
|
||||
/* The attribute __pure__ was added in gcc 2.96. */
|
||||
#undef _GL_ATTRIBUTE_PURE
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
|
||||
# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
|
||||
#else
|
||||
# define _GL_ATTRIBUTE_PURE /* empty */
|
||||
#endif
|
||||
|
||||
/* The results of openat() in this file are not leaked to any
|
||||
single-threaded code that could use stdio.
|
||||
FIXME - if the kernel ever adds support for multi-thread safety for
|
||||
@@ -83,7 +91,7 @@ cdb_advance_fd (struct cd_buf *cdb, char const *dir)
|
||||
}
|
||||
|
||||
/* Return a pointer to the first non-slash in S. */
|
||||
static inline char *
|
||||
static inline char * _GL_ATTRIBUTE_PURE
|
||||
find_non_slash (char const *s)
|
||||
{
|
||||
size_t n_slash = strspn (s, "/");
|
||||
|
||||
@@ -60,6 +60,14 @@ verify (((EXCLUDE_ANCHORED | EXCLUDE_INCLUDE | EXCLUDE_WILDCARDS)
|
||||
| FNM_CASEFOLD | FNM_EXTMATCH))
|
||||
== 0);
|
||||
|
||||
/* The attribute __pure__ was added in gcc 2.96. */
|
||||
#undef _GL_ATTRIBUTE_PURE
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
|
||||
# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
|
||||
#else
|
||||
# define _GL_ATTRIBUTE_PURE /* empty */
|
||||
#endif
|
||||
|
||||
|
||||
/* Exclusion patterns are grouped into a singly-linked list of
|
||||
"exclusion segments". Each segment represents a set of patterns
|
||||
@@ -111,7 +119,7 @@ struct exclude
|
||||
};
|
||||
|
||||
/* Return true if str has wildcard characters */
|
||||
bool
|
||||
bool _GL_ATTRIBUTE_PURE
|
||||
fnmatch_pattern_has_wildcards (const char *str, int options)
|
||||
{
|
||||
const char *cset = "\\?*[]";
|
||||
|
||||
@@ -25,7 +25,15 @@
|
||||
#include <gettext.h>
|
||||
#define _(text) gettext (text)
|
||||
|
||||
char const *
|
||||
/* The attribute __pure__ was added in gcc 2.96. */
|
||||
#undef _GL_ATTRIBUTE_PURE
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
|
||||
# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
|
||||
#else
|
||||
# define _GL_ATTRIBUTE_PURE /* empty */
|
||||
#endif
|
||||
|
||||
char const * _GL_ATTRIBUTE_PURE
|
||||
file_type (struct stat const *st)
|
||||
{
|
||||
/* See POSIX 1003.1-2001 XCU Table 4-8 lines 17093-17107 for some of
|
||||
|
||||
@@ -31,10 +31,18 @@
|
||||
# define mempcpy(D, S, N) ((void *) ((char *) memcpy (D, S, N) + (N)))
|
||||
#endif
|
||||
|
||||
/* The attribute __pure__ was added in gcc 2.96. */
|
||||
#undef _GL_ATTRIBUTE_PURE
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
|
||||
# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
|
||||
#else
|
||||
# define _GL_ATTRIBUTE_PURE /* empty */
|
||||
#endif
|
||||
|
||||
/* Return the longest suffix of F that is a relative file name.
|
||||
If it has no such suffix, return the empty string. */
|
||||
|
||||
static char const *
|
||||
static char const * _GL_ATTRIBUTE_PURE
|
||||
longest_relative_suffix (char const *f)
|
||||
{
|
||||
for (f += FILE_SYSTEM_PREFIX_LEN (f); ISSLASH (*f); f++)
|
||||
|
||||
@@ -26,6 +26,14 @@
|
||||
#include <c-ctype.h>
|
||||
#include <limits.h>
|
||||
|
||||
/* The attribute __pure__ was added in gcc 2.96. */
|
||||
#undef _GL_ATTRIBUTE_PURE
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
|
||||
# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
|
||||
#else
|
||||
# define _GL_ATTRIBUTE_PURE /* empty */
|
||||
#endif
|
||||
|
||||
/* Match a file suffix defined by this regular expression:
|
||||
/(\.[A-Za-z~][A-Za-z0-9~]*)*$/
|
||||
Scan the string *STR and return a pointer to the matching suffix, or
|
||||
@@ -80,7 +88,7 @@ order (unsigned char c)
|
||||
section on the `Version' control field. This version of the code
|
||||
implements that from s5.6.12 of Debian Policy v3.8.0.1
|
||||
http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version */
|
||||
static int
|
||||
static int _GL_ATTRIBUTE_PURE
|
||||
verrevcmp (const char *s1, size_t s1_len, const char *s2, size_t s2_len)
|
||||
{
|
||||
size_t s1_pos = 0;
|
||||
|
||||
@@ -22,7 +22,15 @@
|
||||
#include <stdlib.h>
|
||||
#include "stdio-impl.h"
|
||||
|
||||
size_t
|
||||
/* The attribute __pure__ was added in gcc 2.96. */
|
||||
#undef _GL_ATTRIBUTE_PURE
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
|
||||
# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
|
||||
#else
|
||||
# define _GL_ATTRIBUTE_PURE /* empty */
|
||||
#endif
|
||||
|
||||
size_t _GL_ATTRIBUTE_PURE
|
||||
freadahead (FILE *fp)
|
||||
{
|
||||
#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
|
||||
|
||||
10
lib/fts.c
10
lib/fts.c
@@ -261,6 +261,14 @@ bool fts_debug = false;
|
||||
} \
|
||||
while (false)
|
||||
|
||||
/* The attribute __pure__ was added in gcc 2.96. */
|
||||
#undef _GL_ATTRIBUTE_PURE
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
|
||||
# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
|
||||
#else
|
||||
# define _GL_ATTRIBUTE_PURE /* empty */
|
||||
#endif
|
||||
|
||||
static void
|
||||
fd_ring_clear (I_ring *fd_ring)
|
||||
{
|
||||
@@ -1906,7 +1914,7 @@ fts_padjust (FTS *sp, FTSENT *head)
|
||||
}
|
||||
|
||||
static size_t
|
||||
internal_function
|
||||
internal_function _GL_ATTRIBUTE_PURE
|
||||
fts_maxarglen (char * const *argv)
|
||||
{
|
||||
size_t len, max;
|
||||
|
||||
@@ -23,11 +23,19 @@
|
||||
|
||||
#define SIZE_BITS (sizeof (size_t) * CHAR_BIT)
|
||||
|
||||
/* The attribute __pure__ was added in gcc 2.96. */
|
||||
#undef _GL_ATTRIBUTE_PURE
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
|
||||
# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
|
||||
#else
|
||||
# define _GL_ATTRIBUTE_PURE /* empty */
|
||||
#endif
|
||||
|
||||
/* A hash function for NUL-terminated char* strings using
|
||||
the method described by Bruno Haible.
|
||||
See http://www.haible.de/bruno/hashfunc.html. */
|
||||
|
||||
size_t
|
||||
size_t _GL_ATTRIBUTE_PURE
|
||||
hash_pjw (const void *x, size_t tablesize)
|
||||
{
|
||||
const char *s;
|
||||
|
||||
@@ -29,6 +29,14 @@
|
||||
|
||||
#define STREQ(a, b) (strcmp (a, b) == 0)
|
||||
|
||||
/* The attribute __pure__ was added in gcc 2.96. */
|
||||
#undef _GL_ATTRIBUTE_PURE
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
|
||||
# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
|
||||
#else
|
||||
# define _GL_ATTRIBUTE_PURE /* empty */
|
||||
#endif
|
||||
|
||||
/* Hash an F_triple, and *do* consider the file name. */
|
||||
size_t
|
||||
triple_hash (void const *x, size_t table_size)
|
||||
@@ -41,7 +49,7 @@ triple_hash (void const *x, size_t table_size)
|
||||
}
|
||||
|
||||
/* Hash an F_triple, without considering the file name. */
|
||||
size_t
|
||||
size_t _GL_ATTRIBUTE_PURE
|
||||
triple_hash_no_name (void const *x, size_t table_size)
|
||||
{
|
||||
struct F_triple const *p = x;
|
||||
|
||||
28
lib/hash.c
28
lib/hash.c
@@ -43,6 +43,14 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* The attribute __const__ was added in gcc 2.95. */
|
||||
#undef _GL_ATTRIBUTE_CONST
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
|
||||
# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__))
|
||||
#else
|
||||
# define _GL_ATTRIBUTE_CONST /* empty */
|
||||
#endif
|
||||
|
||||
struct hash_entry
|
||||
{
|
||||
void *data;
|
||||
@@ -146,7 +154,7 @@ static const Hash_tuning default_tuning =
|
||||
number of buckets (used plus unused), or the maximum number of slots, are
|
||||
the same quantity. */
|
||||
|
||||
size_t
|
||||
size_t _GL_ATTRIBUTE_PURE
|
||||
hash_get_n_buckets (const Hash_table *table)
|
||||
{
|
||||
return table->n_buckets;
|
||||
@@ -154,7 +162,7 @@ hash_get_n_buckets (const Hash_table *table)
|
||||
|
||||
/* Return the number of slots in use (non-empty buckets). */
|
||||
|
||||
size_t
|
||||
size_t _GL_ATTRIBUTE_PURE
|
||||
hash_get_n_buckets_used (const Hash_table *table)
|
||||
{
|
||||
return table->n_buckets_used;
|
||||
@@ -162,7 +170,7 @@ hash_get_n_buckets_used (const Hash_table *table)
|
||||
|
||||
/* Return the number of active entries. */
|
||||
|
||||
size_t
|
||||
size_t _GL_ATTRIBUTE_PURE
|
||||
hash_get_n_entries (const Hash_table *table)
|
||||
{
|
||||
return table->n_entries;
|
||||
@@ -170,7 +178,7 @@ hash_get_n_entries (const Hash_table *table)
|
||||
|
||||
/* Return the length of the longest chain (bucket). */
|
||||
|
||||
size_t
|
||||
size_t _GL_ATTRIBUTE_PURE
|
||||
hash_get_max_bucket_length (const Hash_table *table)
|
||||
{
|
||||
struct hash_entry const *bucket;
|
||||
@@ -197,7 +205,7 @@ hash_get_max_bucket_length (const Hash_table *table)
|
||||
/* Do a mild validation of a hash table, by traversing it and checking two
|
||||
statistics. */
|
||||
|
||||
bool
|
||||
bool _GL_ATTRIBUTE_PURE
|
||||
hash_table_ok (const Hash_table *table)
|
||||
{
|
||||
struct hash_entry const *bucket;
|
||||
@@ -284,7 +292,7 @@ hash_lookup (const Hash_table *table, const void *entry)
|
||||
|
||||
/* Return the first data in the table, or NULL if the table is empty. */
|
||||
|
||||
void *
|
||||
void * _GL_ATTRIBUTE_PURE
|
||||
hash_get_first (const Hash_table *table)
|
||||
{
|
||||
struct hash_entry const *bucket;
|
||||
@@ -401,7 +409,7 @@ hash_do_for_each (const Hash_table *table, Hash_processor processor,
|
||||
algorithms tend to be domain-specific, so what's good for [diffutils'] io.c
|
||||
may not be good for your application." */
|
||||
|
||||
size_t
|
||||
size_t _GL_ATTRIBUTE_PURE
|
||||
hash_string (const char *string, size_t n_buckets)
|
||||
{
|
||||
# define HASH_ONE_CHAR(Value, Byte) \
|
||||
@@ -440,7 +448,7 @@ hash_string (const char *string, size_t n_buckets)
|
||||
/* Return true if CANDIDATE is a prime number. CANDIDATE should be an odd
|
||||
number at least equal to 11. */
|
||||
|
||||
static bool
|
||||
static bool _GL_ATTRIBUTE_CONST
|
||||
is_prime (size_t candidate)
|
||||
{
|
||||
size_t divisor = 3;
|
||||
@@ -459,7 +467,7 @@ is_prime (size_t candidate)
|
||||
/* Round a given CANDIDATE number up to the nearest prime, and return that
|
||||
prime. Primes lower than 10 are merely skipped. */
|
||||
|
||||
static size_t
|
||||
static size_t _GL_ATTRIBUTE_CONST
|
||||
next_prime (size_t candidate)
|
||||
{
|
||||
/* Skip small primes. */
|
||||
@@ -540,7 +548,7 @@ check_tuning (Hash_table *table)
|
||||
TUNING, or return 0 if there is no possible way to allocate that
|
||||
many entries. */
|
||||
|
||||
static size_t
|
||||
static size_t _GL_ATTRIBUTE_PURE
|
||||
compute_bucket_size (size_t candidate, const Hash_tuning *tuning)
|
||||
{
|
||||
if (!tuning->is_n_buckets)
|
||||
|
||||
10
lib/i-ring.c
10
lib/i-ring.c
@@ -21,6 +21,14 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
/* The attribute __pure__ was added in gcc 2.96. */
|
||||
#undef _GL_ATTRIBUTE_PURE
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
|
||||
# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
|
||||
#else
|
||||
# define _GL_ATTRIBUTE_PURE /* empty */
|
||||
#endif
|
||||
|
||||
void
|
||||
i_ring_init (I_ring *ir, int default_val)
|
||||
{
|
||||
@@ -33,7 +41,7 @@ i_ring_init (I_ring *ir, int default_val)
|
||||
ir->ir_default_val = default_val;
|
||||
}
|
||||
|
||||
bool
|
||||
bool _GL_ATTRIBUTE_PURE
|
||||
i_ring_empty (I_ring const *ir)
|
||||
{
|
||||
return ir->ir_empty;
|
||||
|
||||
10
lib/isnan.c
10
lib/isnan.c
@@ -79,7 +79,15 @@ extern int rpl_isnanf (float x);
|
||||
((sizeof (DOUBLE) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
|
||||
typedef union { DOUBLE value; unsigned int word[NWORDS]; } memory_double;
|
||||
|
||||
int
|
||||
/* The attribute __const__ was added in gcc 2.95. */
|
||||
#undef _GL_ATTRIBUTE_CONST
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
|
||||
# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__))
|
||||
#else
|
||||
# define _GL_ATTRIBUTE_CONST /* empty */
|
||||
#endif
|
||||
|
||||
int _GL_ATTRIBUTE_CONST
|
||||
FUNC (DOUBLE x)
|
||||
{
|
||||
#ifdef KNOWN_EXPBIT0_LOCATION
|
||||
|
||||
@@ -24,11 +24,19 @@
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
|
||||
/* The attribute __pure__ was added in gcc 2.96. */
|
||||
#undef _GL_ATTRIBUTE_PURE
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
|
||||
# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
|
||||
#else
|
||||
# define _GL_ATTRIBUTE_PURE /* empty */
|
||||
#endif
|
||||
|
||||
/* Like memcmp, but ignore differences in case.
|
||||
Convert to upper case (not lower) before comparing so that
|
||||
join -i works with sort -f. */
|
||||
|
||||
int
|
||||
int _GL_ATTRIBUTE_PURE
|
||||
memcasecmp (const void *vs1, const void *vs2, size_t n)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
@@ -29,10 +29,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
/* The attribute __pure__ was added in gcc 2.96. */
|
||||
#undef _GL_ATTRIBUTE_PURE
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
|
||||
# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
|
||||
#else
|
||||
# define _GL_ATTRIBUTE_PURE /* empty */
|
||||
#endif
|
||||
|
||||
/* Return the first address of either C1 or C2 (treated as unsigned
|
||||
char) that occurs within N bytes of the memory region S. If
|
||||
neither byte appears, return NULL. */
|
||||
void *
|
||||
void * _GL_ATTRIBUTE_PURE
|
||||
memchr2 (void const *s, int c1_in, int c2_in, size_t n)
|
||||
{
|
||||
/* On 32-bit hardware, choosing longword to be a 32-bit unsigned
|
||||
|
||||
@@ -21,7 +21,15 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
int
|
||||
/* The attribute __pure__ was added in gcc 2.96. */
|
||||
#undef _GL_ATTRIBUTE_PURE
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
|
||||
# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
|
||||
#else
|
||||
# define _GL_ATTRIBUTE_PURE /* empty */
|
||||
#endif
|
||||
|
||||
int _GL_ATTRIBUTE_PURE
|
||||
memcmp2 (const char *s1, size_t n1, const char *s2, size_t n2)
|
||||
{
|
||||
int cmp = memcmp (s1, s2, n1 <= n2 ? n1 : n2);
|
||||
|
||||
@@ -113,6 +113,14 @@ typedef long int long_time_t;
|
||||
typedef time_t long_time_t;
|
||||
#endif
|
||||
|
||||
/* The attribute __pure__ was added in gcc 2.96. */
|
||||
#undef _GL_ATTRIBUTE_PURE
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
|
||||
# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
|
||||
#else
|
||||
# define _GL_ATTRIBUTE_PURE /* empty */
|
||||
#endif
|
||||
|
||||
/* Lots of this code assumes time_t and time_t-like values fit into
|
||||
long_time_t. */
|
||||
verify (TYPE_MINIMUM (long_time_t) <= TYPE_MINIMUM (time_t)
|
||||
@@ -868,7 +876,7 @@ to_year (textint textyear)
|
||||
return year;
|
||||
}
|
||||
|
||||
static table const *
|
||||
static table const * _GL_ATTRIBUTE_PURE
|
||||
lookup_zone (parser_control const *pc, char const *name)
|
||||
{
|
||||
table const *tp;
|
||||
|
||||
@@ -38,6 +38,14 @@
|
||||
#include "xalloc.h"
|
||||
#include "gettext.h"
|
||||
|
||||
/* The attribute __const__ was added in gcc 2.95. */
|
||||
#undef _GL_ATTRIBUTE_CONST
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
|
||||
# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__))
|
||||
#else
|
||||
# define _GL_ATTRIBUTE_CONST /* empty */
|
||||
#endif
|
||||
|
||||
|
||||
/* Tests whether STRING contains trim (SUB), starting and ending at word
|
||||
boundaries.
|
||||
@@ -148,7 +156,7 @@ mbsstr_trimmed_wordbounded (const char *string, const char *sub)
|
||||
|
||||
/* Return the localization of NAME. NAME is written in ASCII. */
|
||||
|
||||
const char *
|
||||
const char * _GL_ATTRIBUTE_CONST
|
||||
proper_name (const char *name)
|
||||
{
|
||||
/* See whether there is a translation. */
|
||||
|
||||
@@ -42,6 +42,14 @@
|
||||
|
||||
#define INT_BITS (sizeof (int) * CHAR_BIT)
|
||||
|
||||
/* The attribute __pure__ was added in gcc 2.96. */
|
||||
#undef _GL_ATTRIBUTE_PURE
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
|
||||
# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
|
||||
#else
|
||||
# define _GL_ATTRIBUTE_PURE /* empty */
|
||||
#endif
|
||||
|
||||
struct quoting_options
|
||||
{
|
||||
/* Basic quoting style. */
|
||||
@@ -105,7 +113,7 @@ clone_quoting_options (struct quoting_options *o)
|
||||
}
|
||||
|
||||
/* Get the value of O's quoting style. If O is null, use the default. */
|
||||
enum quoting_style
|
||||
enum quoting_style _GL_ATTRIBUTE_PURE
|
||||
get_quoting_style (struct quoting_options *o)
|
||||
{
|
||||
return (o ? o : &default_quoting_options)->style;
|
||||
|
||||
@@ -22,6 +22,14 @@
|
||||
/* Specification. */
|
||||
#include "sockets.h"
|
||||
|
||||
/* The attribute __const__ was added in gcc 2.95. */
|
||||
#undef _GL_ATTRIBUTE_CONST
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
|
||||
# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__))
|
||||
#else
|
||||
# define _GL_ATTRIBUTE_CONST /* empty */
|
||||
#endif
|
||||
|
||||
#if WINDOWS_SOCKETS
|
||||
|
||||
/* This includes winsock2.h on MinGW. */
|
||||
@@ -103,7 +111,7 @@ static int initialized_sockets_version /* = 0 */;
|
||||
|
||||
#endif /* WINDOWS_SOCKETS */
|
||||
|
||||
int
|
||||
int _GL_ATTRIBUTE_CONST
|
||||
gl_sockets_startup (int version _GL_UNUSED)
|
||||
{
|
||||
#if WINDOWS_SOCKETS
|
||||
|
||||
@@ -21,10 +21,18 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/* The attribute __pure__ was added in gcc 2.96. */
|
||||
#undef _GL_ATTRIBUTE_PURE
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
|
||||
# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
|
||||
#else
|
||||
# define _GL_ATTRIBUTE_PURE /* empty */
|
||||
#endif
|
||||
|
||||
/* Find the length of STRING + 1, but scan at most MAXLEN bytes.
|
||||
If no '\0' terminator is found in that many characters, return MAXLEN. */
|
||||
/* This is the same as strnlen (string, maxlen - 1) + 1. */
|
||||
size_t
|
||||
size_t _GL_ATTRIBUTE_PURE
|
||||
strnlen1 (const char *string, size_t maxlen)
|
||||
{
|
||||
const char *end = (const char *) memchr (string, '\0', maxlen);
|
||||
|
||||
@@ -22,6 +22,14 @@
|
||||
|
||||
#include "cjk.h"
|
||||
|
||||
/* The attribute __pure__ was added in gcc 2.96. */
|
||||
#undef _GL_ATTRIBUTE_PURE
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
|
||||
# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
|
||||
#else
|
||||
# define _GL_ATTRIBUTE_PURE /* empty */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Non-spacing attribute table.
|
||||
* Consists of:
|
||||
@@ -311,7 +319,7 @@ static const signed char nonspacing_table_ind[240] = {
|
||||
};
|
||||
|
||||
/* Determine number of column positions required for UC. */
|
||||
int
|
||||
int _GL_ATTRIBUTE_PURE
|
||||
uc_width (ucs4_t uc, const char *encoding)
|
||||
{
|
||||
/* Test for non-spacing or control character. */
|
||||
|
||||
Reference in New Issue
Block a user