blob: 880d80b106df67c8317b39ad395d3f323b84e4c9 [file] [log] [blame]
Andrew Geisslerf103a7f2021-05-07 16:09:40 -05001From 408e7dfaf2eb735804f62728de679972867c30d5 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 3 May 2021 13:53:10 -0700
4Subject: [PATCH] replace __pure__ with compiler attribute 'pure'
5
6Remove defining __deprecated__
7
Andrew Geissler6aa7eec2023-03-03 12:41:14 -06008Upstream-Status: Inappropriate [Untested with dietlibc]
Andrew Geisslerf103a7f2021-05-07 16:09:40 -05009Signed-off-by: Khem Raj <raj.khem@gmail.com>
10---
11 byte.h | 22 ++++++----
12 critbit.h | 12 ++++--
13 fmt.h | 100 +++++++++++++++++++++++---------------------
14 str.h | 22 ++++++----
15 stralloc.h | 20 +++++----
16 5 files changed, 103 insertions(+), 73 deletions(-)
17
18--- a/byte.h
19+++ b/byte.h
20@@ -2,6 +2,16 @@
21 #ifndef BYTE_H
22 #define BYTE_H
23
24+#ifndef __has_attribute
25+ #define __has_attribute(x) 0
26+#endif
27+
28+#if __has_attribute(pure)
29+#define __PURE __attribute__ ((pure))
30+#else
31+#define __PURE
32+#endif
33+
34 /* for size_t: */
35 #include <stddef.h>
36
37@@ -9,17 +19,13 @@
38 extern "C" {
39 #endif
40
41-#ifndef __pure__
42-#define __pure__
43-#endif
44-
45 /* byte_chr returns the smallest integer i between 0 and len-1
46 * inclusive such that one[i] equals needle, or len if not found. */
47-size_t byte_chr(const void* haystack, size_t len, char needle) __pure__;
48+size_t byte_chr(const void* haystack, size_t len, char needle) __PURE;
49
50 /* byte_rchr returns the largest integer i between 0 and len-1 inclusive
51 * such that one[i] equals needle, or len if not found. */
52-size_t byte_rchr(const void* haystack,size_t len,char needle) __pure__;
53+size_t byte_rchr(const void* haystack,size_t len,char needle) __PURE;
54
55 /* byte_copy copies in[0] to out[0], in[1] to out[1], ... and in[len-1]
56 * to out[len-1]. */
57@@ -34,14 +40,14 @@ void byte_copyr(void* out, size_t len, c
58 * than, equal to, or greater than the string b[0], b[1], ...,
59 * b[len-1]. When the strings are different, byte_diff does not read
60 * bytes past the first difference. */
61-int byte_diff(const void* a, size_t len, const void* b) __pure__;
62+int byte_diff(const void* a, size_t len, const void* b) __PURE;
63
64 /* byte_zero sets the bytes out[0], out[1], ..., out[len-1] to 0 */
65 void byte_zero(void* out, size_t len);
66
67 #define byte_equal(s,n,t) (!byte_diff((s),(n),(t)))
68
69-int byte_equal_notimingattack(const void* a, size_t len,const void* b) __pure__;
70+int byte_equal_notimingattack(const void* a, size_t len,const void* b) __PURE;
71
72 #if defined(__i386__) || defined(__x86_64__)
73 #define UNALIGNED_ACCESS_OK
74--- a/critbit.h
75+++ b/critbit.h
76@@ -8,15 +8,21 @@ extern "C" {
77 /* for __pure__ if we are compiling under dietlibc */
78 #include <stddef.h>
79
80-#ifndef __pure__
81-#define __pure__
82+#ifndef __has_attribute
83+ #define __has_attribute(x) 0
84+#endif
85+
86+#if __has_attribute(pure)
87+#define __PURE __attribute__ ((pure))
88+#else
89+#define __PURE
90 #endif
91
92 typedef struct {
93 void *root;
94 } critbit0_tree;
95
96-int critbit0_contains(critbit0_tree *t, const char *u) __pure__;
97+int critbit0_contains(critbit0_tree *t, const char *u) __PURE;
98 int critbit0_insert(critbit0_tree *t, const char *u);
99 int critbit0_delete(critbit0_tree *t, const char *u);
100 void critbit0_clear(critbit0_tree *t);
101--- a/fmt.h
102+++ b/fmt.h
103@@ -2,6 +2,16 @@
104 #ifndef FMT_H
105 #define FMT_H
106
107+#ifndef __has_attribute
108+ #define __has_attribute(x) 0
109+#endif
110+
111+#if __has_attribute(pure)
112+#define __PURE __attribute__ ((pure))
113+#else
114+#define __PURE
115+#endif
116+
117 /* for size_t: */
118 #include <stddef.h>
119 /* for uint32_t */
120@@ -15,10 +25,6 @@
121 extern "C" {
122 #endif
123
124-#ifndef __pure__
125-#define __pure__
126-#endif
127-
128 #define FMT_LONG 41 /* enough space to hold -2^127 in decimal, plus \0 */
129 #define FMT_ULONG 40 /* enough space to hold 2^128 - 1 in decimal, plus \0 */
130 #define FMT_8LONG 44 /* enough space to hold 2^128 - 1 in octal, plus \0 */
131@@ -46,31 +52,31 @@ extern "C" {
132 /* convert signed src integer -23 to ASCII '-','2','3', return number of
133 * bytes of value in output format (3 in this example).
134 * If dest is not NULL, write result to dest */
135-size_t fmt_long(char *dest,signed long src) __pure__;
136+size_t fmt_long(char *dest,signed long src) __PURE;
137
138 /* convert unsigned src integer 23 to ASCII '2','3', return number of
139 * bytes of value in output format (2 in this example).
140 * If dest is not NULL, write result to dest */
141-size_t fmt_ulong(char *dest,unsigned long src) __pure__;
142+size_t fmt_ulong(char *dest,unsigned long src) __PURE;
143
144 /* convert unsigned src integer 0x23 to ASCII '2','3', return number of
145 * bytes of value in output format (2 in this example).
146 * If dest is not NULL, write result to dest */
147-size_t fmt_xlong(char *dest,unsigned long src) __pure__;
148+size_t fmt_xlong(char *dest,unsigned long src) __PURE;
149
150 /* convert unsigned src integer 023 to ASCII '2','3', return number of
151 * bytes of value in output format (2 in this example).
152 * If dest is not NULL, write result to dest */
153-size_t fmt_8long(char *dest,unsigned long src) __pure__;
154+size_t fmt_8long(char *dest,unsigned long src) __PURE;
155
156 /* like fmt_long but for long long */
157-size_t fmt_longlong(char *dest,signed long long src) __pure__;
158+size_t fmt_longlong(char *dest,signed long long src) __PURE;
159
160 /* like fmt_ulong but for unsigned long long */
161-size_t fmt_ulonglong(char *dest,unsigned long long src) __pure__;
162+size_t fmt_ulonglong(char *dest,unsigned long long src) __PURE;
163
164 /* like fmt_xlong but for unsigned long long */
165-size_t fmt_xlonglong(char *dest,unsigned long long src) __pure__;
166+size_t fmt_xlonglong(char *dest,unsigned long long src) __PURE;
167
168 #define fmt_uint(dest,src) fmt_ulong(dest,src)
169 #define fmt_int(dest,src) fmt_long(dest,src)
170@@ -81,22 +87,22 @@ size_t fmt_xlonglong(char *dest,unsigned
171 * Does not truncate! */
172 /* fmt_ulong0(buf,23,4) -> '0','0','2','3' return 4 */
173 /* fmt_ulong0(buf,234,2) -> '2','3','4', return 3 */
174-size_t fmt_ulong0(char *,unsigned long src,size_t padto) __pure__;
175+size_t fmt_ulong0(char *,unsigned long src,size_t padto) __PURE;
176
177 #define fmt_uint0(buf,src,padto) fmt_ulong0(buf,src,padto)
178
179 /* convert src double 1.7 to ASCII '1','.','7', return length.
180 * If dest is not NULL, write result to dest */
181-size_t fmt_double(char *dest, double d,int max,int prec) __pure__;
182+size_t fmt_double(char *dest, double d,int max,int prec) __PURE;
183
184 /* if src is negative, write '-' and return 1.
185 * if src is positive, write '+' and return 1.
186 * otherwise return 0 */
187-size_t fmt_plusminus(char *dest,int src) __pure__;
188+size_t fmt_plusminus(char *dest,int src) __PURE;
189
190 /* if src is negative, write '-' and return 1.
191 * otherwise return 0. */
192-size_t fmt_minus(char *dest,int src) __pure__;
193+size_t fmt_minus(char *dest,int src) __PURE;
194
195 /* copy str to dest until \0 byte, return number of copied bytes. */
196 /* fmt_str(NULL,str) == strlen(str) */
197@@ -108,11 +114,11 @@ size_t fmt_minus(char *dest,int src) __p
198 * This is more efficient because strcat needs to scan the string to
199 * find the end and append.
200 */
201-size_t fmt_str(char *dest,const char *src) __pure__;
202+size_t fmt_str(char *dest,const char *src) __PURE;
203
204 /* copy str to dest until \0 byte or limit bytes copied.
205 * return number of copied bytes. */
206-size_t fmt_strn(char *dest,const char *src,size_t limit) __pure__;
207+size_t fmt_strn(char *dest,const char *src,size_t limit) __PURE;
208
209 /* copy n bytes from src to dest, return n */
210 static inline size_t fmt_copybytes(char* dest,const char* src,size_t n) {
211@@ -124,56 +130,56 @@ static inline size_t fmt_copybytes(char*
212 * write padlen-srclen spaces, if that is >= 0. Then copy srclen
213 * characters from src. Truncate only if total length is larger than
214 * maxlen. Return number of characters written. */
215-size_t fmt_pad(char* dest,const char* src,size_t srclen,size_t padlen,size_t maxlen) __pure__;
216+size_t fmt_pad(char* dest,const char* src,size_t srclen,size_t padlen,size_t maxlen) __PURE;
217
218 /* "foo" -> "foo "
219 * append padlen-srclen spaces after dest, if that is >= 0. Truncate
220 * only if total length is larger than maxlen. Return number of
221 * characters written. */
222-size_t fmt_fill(char* dest,size_t srclen,size_t padlen,size_t maxlen) __pure__;
223+size_t fmt_fill(char* dest,size_t srclen,size_t padlen,size_t maxlen) __PURE;
224
225 /* 1 -> "1", 4900 -> "4.9k", 2300000 -> "2.3M" */
226-size_t fmt_human(char* dest,unsigned long long l) __pure__;
227+size_t fmt_human(char* dest,unsigned long long l) __PURE;
228
229 /* 1 -> "1", 4900 -> "4.8k", 2300000 -> "2.2M" */
230-size_t fmt_humank(char* dest,unsigned long long l) __pure__;
231+size_t fmt_humank(char* dest,unsigned long long l) __PURE;
232
233 /* "Sun, 06 Nov 1994 08:49:37 GMT" */
234 size_t fmt_httpdate(char* dest,time_t t); /* not marked pure because it calls gmtime */
235
236 /* "2014-05-27T19:22:16.247Z" */
237-size_t fmt_iso8601(char* dest,time_t t) __pure__;
238+size_t fmt_iso8601(char* dest,time_t t) __PURE;
239
240 #define FMT_UTF8 5
241 #define FMT_ASN1LENGTH 17 /* enough space to hold 2^128-1 */
242 #define FMT_ASN1TAG 19 /* enough space to hold 2^128-1 */
243
244 /* some variable length encodings for integers */
245-size_t fmt_utf8(char* dest,uint32_t n) __pure__; /* can store 0-0x7fffffff */
246-size_t fmt_asn1derlength(char* dest,unsigned long long l) __pure__; /* 0-0x7f: 1 byte, above that 1+bytes_needed bytes */
247-size_t fmt_asn1dertag(char* dest,unsigned long long l) __pure__; /* 1 byte for each 7 bits; upper bit = more bytes coming */
248+size_t fmt_utf8(char* dest,uint32_t n) __PURE; /* can store 0-0x7fffffff */
249+size_t fmt_asn1derlength(char* dest,unsigned long long l) __PURE; /* 0-0x7f: 1 byte, above that 1+bytes_needed bytes */
250+size_t fmt_asn1dertag(char* dest,unsigned long long l) __PURE; /* 1 byte for each 7 bits; upper bit = more bytes coming */
251
252 /* Google Protocol Buffers, https://developers.google.com/protocol-buffers/docs/encoding */
253-size_t fmt_varint(char* dest,unsigned long long l) __pure__; /* protocol buffers encoding; like asn1dertag but little endian */
254-size_t fmt_pb_tag(char* dest,size_t fieldno,unsigned char type) __pure__; /* protocol buffer tag */
255-size_t fmt_pb_type0_int(char* dest,unsigned long long l) __pure__; /* protocol buffers encoding: type 0 bool/enum/int32/uint32/int64/uint64 */
256-size_t fmt_pb_type0_sint(char* dest,signed long long l) __pure__;/* protocol buffers encoding: type 0 sint32/sint64 */
257-size_t fmt_pb_type1_double(char* dest,double d) __pure__; /* protocol buffers encoding: double (64-bit little endian blob) */
258-size_t fmt_pb_type1_fixed64(char* dest,uint64_t l) __pure__; /* protocol buffers encoding: 64-bit little endian blob */
259+size_t fmt_varint(char* dest,unsigned long long l) __PURE; /* protocol buffers encoding; like asn1dertag but little endian */
260+size_t fmt_pb_tag(char* dest,size_t fieldno,unsigned char type) __PURE; /* protocol buffer tag */
261+size_t fmt_pb_type0_int(char* dest,unsigned long long l) __PURE; /* protocol buffers encoding: type 0 bool/enum/int32/uint32/int64/uint64 */
262+size_t fmt_pb_type0_sint(char* dest,signed long long l) __PURE;/* protocol buffers encoding: type 0 sint32/sint64 */
263+size_t fmt_pb_type1_double(char* dest,double d) __PURE; /* protocol buffers encoding: double (64-bit little endian blob) */
264+size_t fmt_pb_type1_fixed64(char* dest,uint64_t l) __PURE; /* protocol buffers encoding: 64-bit little endian blob */
265
266 /* fmt_pb_type2_string can return 0 if (s,l) is clearly invalid */
267-size_t fmt_pb_type2_string(char* dest,const char* s,size_t l) __pure__; /* protocol buffers encoding: varint length + blob */
268-size_t fmt_pb_type5_float(char* dest,float f) __pure__; /* protocol buffers encoding: float (32-bit little endian blob) */
269-size_t fmt_pb_type5_fixed32(char* dest,uint32_t l) __pure__; /* protocol buffers encoding: 32-bit little endian blob */
270-
271-size_t fmt_pb_int(char* dest,size_t fieldno,unsigned long long l) __pure__;
272-size_t fmt_pb_sint(char* dest,size_t fieldno,signed long long l) __pure__;
273-size_t fmt_pb_double(char* dest,size_t fieldno,double d) __pure__;
274-size_t fmt_pb_float(char* dest,size_t fieldno,float f) __pure__;
275-size_t fmt_pb_string(char* dest,size_t fieldno,const char* s,size_t l) __pure__;
276+size_t fmt_pb_type2_string(char* dest,const char* s,size_t l) __PURE; /* protocol buffers encoding: varint length + blob */
277+size_t fmt_pb_type5_float(char* dest,float f) __PURE; /* protocol buffers encoding: float (32-bit little endian blob) */
278+size_t fmt_pb_type5_fixed32(char* dest,uint32_t l) __PURE; /* protocol buffers encoding: 32-bit little endian blob */
279+
280+size_t fmt_pb_int(char* dest,size_t fieldno,unsigned long long l) __PURE;
281+size_t fmt_pb_sint(char* dest,size_t fieldno,signed long long l) __PURE;
282+size_t fmt_pb_double(char* dest,size_t fieldno,double d) __PURE;
283+size_t fmt_pb_float(char* dest,size_t fieldno,float f) __PURE;
284+size_t fmt_pb_string(char* dest,size_t fieldno,const char* s,size_t l) __PURE;
285
286 /* fmt_netstring can return 0 if (src,len) is clearly invalid */
287-size_t fmt_netstring(char* dest,const char* src,size_t len) __pure__;
288+size_t fmt_netstring(char* dest,const char* src,size_t len) __PURE;
289
290 /* Marshaling helper functions.
291 * Escape one character, no matter if it needs escaping or not.
292@@ -185,27 +191,27 @@ size_t fmt_netstring(char* dest,const ch
293 * unicode codepoint) may be limited to 0x7f, 0xff or 0x10ffff. */
294
295 /* XML escaping: '&' -> '&amp;', '<' -> '&lt;', 'ö' -> '&#xf6;' */
296-size_t fmt_escapecharxml(char* dest,uint32_t ch) __pure__;
297+size_t fmt_escapecharxml(char* dest,uint32_t ch) __PURE;
298 /* HTML escaping is the same as XML escaping. */
299-size_t fmt_escapecharhtml(char* dest,uint32_t ch) __pure__;
300+size_t fmt_escapecharhtml(char* dest,uint32_t ch) __PURE;
301
302 /* JSON escaping: '\' -> '\\', '"' -> '\"', 'ö' -> '\u00f6' */
303-size_t fmt_escapecharjson(char* dest,uint32_t ch) __pure__;
304+size_t fmt_escapecharjson(char* dest,uint32_t ch) __PURE;
305
306 /* MIME quoted-printable escaping: 'ö' -> '=f6', characters > 0xff not supported */
307-size_t fmt_escapecharquotedprintable(char* dest,uint32_t ch) __pure__;
308+size_t fmt_escapecharquotedprintable(char* dest,uint32_t ch) __PURE;
309
310 /* MIME quoted-printable escaping with UTF-8: 'ö' -> '=c3=b6', characters > 0x7fffffff not supported */
311-size_t fmt_escapecharquotedprintableutf8(char* dest,uint32_t ch) __pure__;
312+size_t fmt_escapecharquotedprintableutf8(char* dest,uint32_t ch) __PURE;
313
314 /* C99 style escaping: '\' -> '\\', newline -> '\n', 0xc2 -> '\302' */
315-size_t fmt_escapecharc(char* dest,uint32_t ch) __pure__;
316+size_t fmt_escapecharc(char* dest,uint32_t ch) __PURE;
317
318 /* internal functions, may be independently useful */
319 char fmt_tohex(char c) __attribute__((__const__));
320
321 #define fmt_strm(b,...) fmt_strm_internal(b,__VA_ARGS__,(char*)0)
322-size_t fmt_strm_internal(char* dest,...) __pure__;
323+size_t fmt_strm_internal(char* dest,...) __PURE;
324
325 #ifndef MAX_ALLOCA
326 #define MAX_ALLOCA 100000
327--- a/str.h
328+++ b/str.h
329@@ -8,8 +8,14 @@
330 extern "C" {
331 #endif
332
333-#ifndef __pure__
334-#define __pure__
335+#ifndef __has_attribute
336+ #define __has_attribute(x) 0
337+#endif
338+
339+#if __has_attribute(pure)
340+#define __PURE __attribute__ ((pure))
341+#else
342+#define __PURE
343 #endif
344
345 /* str_copy copies leading bytes from in to out until \0.
346@@ -21,7 +27,7 @@ size_t str_copy(char *out,const char *in
347 * equal to, or greater than the string b[0], b[1], ..., b[m-1]=='\0'.
348 * If the strings are different, str_diff does not read bytes past the
349 * first difference. */
350-int str_diff(const char *a,const char *b) __pure__;
351+int str_diff(const char *a,const char *b) __PURE;
352
353 /* str_diffn returns negative, 0, or positive, depending on whether the
354 * string a[0], a[1], ..., a[n]=='\0' is lexicographically smaller than,
355@@ -29,24 +35,24 @@ int str_diff(const char *a,const char *b
356 * If the strings are different, str_diffn does not read bytes past the
357 * first difference. The strings will be considered equal if the first
358 * limit characters match. */
359-int str_diffn(const char *a,const char *b,size_t limit) __pure__;
360+int str_diffn(const char *a,const char *b,size_t limit) __PURE;
361
362 #ifdef __dietlibc__
363 #include <string.h>
364 #define str_len(foo) strlen(foo)
365 #else
366 /* str_len returns the index of \0 in s */
367-size_t str_len(const char *s) __pure__;
368+size_t str_len(const char *s) __PURE;
369 #endif
370
371 /* str_chr returns the index of the first occurance of needle or \0 in haystack */
372-size_t str_chr(const char *haystack,char needle) __pure__;
373+size_t str_chr(const char *haystack,char needle) __PURE;
374
375 /* str_rchr returns the index of the last occurance of needle or \0 in haystack */
376-size_t str_rchr(const char *haystack,char needle) __pure__;
377+size_t str_rchr(const char *haystack,char needle) __PURE;
378
379 /* str_start returns 1 if the b is a prefix of a, 0 otherwise */
380-int str_start(const char *a,const char *b) __pure__;
381+int str_start(const char *a,const char *b) __PURE;
382
383 /* convenience shortcut to test for string equality */
384 #define str_equal(s,t) (!str_diff((s),(t)))
385--- a/stralloc.h
386+++ b/stralloc.h
387@@ -2,16 +2,22 @@
388 #ifndef STRALLOC_H
389 #define STRALLOC_H
390
391+#ifndef __has_attribute
392+ #define __has_attribute(x) 0
393+#endif
394+
395+#if __has_attribute(pure)
396+#define __PURE __attribute__ ((pure))
397+#else
398+#define __PURE
399+#endif
400+
401 #include <stddef.h>
402
403 #ifdef __cplusplus
404 extern "C" {
405 #endif
406
407-#ifndef __pure__
408-#define __pure__
409-#endif
410-
411 /* stralloc is the internal data structure all functions are working on.
412 * s is the string.
413 * len is the used length of the string.
414@@ -101,17 +107,17 @@ static inline int stralloc_APPEND(strall
415 /* stralloc_starts returns 1 if the \0-terminated string in "in", without
416 * the terminating \0, is a prefix of the string stored in sa. Otherwise
417 * it returns 0. sa must already be allocated. */
418-int stralloc_starts(stralloc* sa,const char* in) __pure__;
419+int stralloc_starts(stralloc* sa,const char* in) __PURE;
420
421 /* stralloc_diff returns negative, 0, or positive, depending on whether
422 * a is lexicographically smaller than, equal to, or greater than the
423 * string b. */
424-int stralloc_diff(const stralloc* a,const stralloc* b) __pure__;
425+int stralloc_diff(const stralloc* a,const stralloc* b) __PURE;
426
427 /* stralloc_diffs returns negative, 0, or positive, depending on whether
428 * a is lexicographically smaller than, equal to, or greater than the
429 * string b[0], b[1], ..., b[n]=='\0'. */
430-int stralloc_diffs(const stralloc* a,const char* b) __pure__;
431+int stralloc_diffs(const stralloc* a,const char* b) __PURE;
432
433 #define stralloc_equal(a,b) (!stralloc_diff((a),(b)))
434 #define stralloc_equals(a,b) (!stralloc_diffs((a),(b)))
435--- a/scan.h
436+++ b/scan.h
437@@ -15,8 +15,14 @@
438 extern "C" {
439 #endif
440
441-#ifndef __pure__
442-#define __pure__
443+#ifndef __has_attribute
444+ #define __has_attribute(x) 0
445+#endif
446+
447+#if __has_attribute(pure)
448+#define __PURE __attribute__ ((pure))
449+#else
450+#define __PURE
451 #endif
452
453 /* This file declared functions used to decode / scan / unmarshal
454@@ -84,18 +90,18 @@ size_t scan_double(const char *in, doubl
455 size_t scan_plusminus(const char *src,signed int *dest);
456
457 /* return the highest integer n<=limit so that isspace(in[i]) for all 0<=i<=n */
458-size_t scan_whitenskip(const char *in,size_t limit) __pure__;
459+size_t scan_whitenskip(const char *in,size_t limit) __PURE;
460
461 /* return the highest integer n<=limit so that !isspace(in[i]) for all 0<=i<=n */
462-size_t scan_nonwhitenskip(const char *in,size_t limit) __pure__;
463+size_t scan_nonwhitenskip(const char *in,size_t limit) __PURE;
464
465 /* return the highest integer n<=limit so that in[i] is element of
466 * charset (ASCIIZ string) for all 0<=i<=n */
467-size_t scan_charsetnskip(const char *in,const char *charset,size_t limit) __pure__;
468+size_t scan_charsetnskip(const char *in,const char *charset,size_t limit) __PURE;
469
470 /* return the highest integer n<=limit so that in[i] is not element of
471 * charset (ASCIIZ string) for all 0<=i<=n */
472-size_t scan_noncharsetnskip(const char *in,const char *charset,size_t limit) __pure__;
473+size_t scan_noncharsetnskip(const char *in,const char *charset,size_t limit) __PURE;
474
475 /* try to parse ASCII GMT date; does not understand time zones. */
476 /* example dates:
477@@ -103,17 +109,17 @@ size_t scan_noncharsetnskip(const char *
478 * "Sunday, 06-Nov-94 08:49:37 GMT"
479 * "Sun Nov 6 08:49:37 1994"
480 */
481-size_t scan_httpdate(const char *in,time_t *t) __pure__;
482+size_t scan_httpdate(const char *in,time_t *t) __PURE;
483
484 /* try to parse ASCII ISO-8601 date; does not understand time zones. */
485 /* example date: "2014-05-27T19:22:16Z" */
486-size_t scan_iso8601(const char* in,struct timespec* t) __pure__;
487+size_t scan_iso8601(const char* in,struct timespec* t) __PURE;
488
489 /* some variable length encodings for integers */
490-size_t scan_utf8(const char* in,size_t len,uint32_t* n) __pure__;
491-size_t scan_utf8_sem(const char* in,size_t len,uint32_t* n) __pure__;
492-size_t scan_asn1derlength(const char* in,size_t len,unsigned long long* n) __pure__;
493-size_t scan_asn1dertag(const char* in,size_t len,unsigned long long* n) __pure__;
494+size_t scan_utf8(const char* in,size_t len,uint32_t* n) __PURE;
495+size_t scan_utf8_sem(const char* in,size_t len,uint32_t* n) __PURE;
496+size_t scan_asn1derlength(const char* in,size_t len,unsigned long long* n) __PURE;
497+size_t scan_asn1dertag(const char* in,size_t len,unsigned long long* n) __PURE;
498
499 /* Google protocol buffers */
500 /* A protocol buffer is a sequence of (tag,value).
501@@ -121,16 +127,16 @@ size_t scan_asn1dertag(const char* in,si
502 * which field in your struct is being sent. Integers must have type
503 * 0, double type 1, strings type 2 and floats type 5. However, you
504 * have to check this yourself.
505- */
506-size_t scan_varint(const char* in,size_t len, unsigned long long* n) __pure__; /* internal */
507-size_t scan_pb_tag(const char* in,size_t len, size_t* fieldno,unsigned char* type) __pure__;
508+ */
509+size_t scan_varint(const char* in,size_t len, unsigned long long* n) __PURE; /* internal */
510+size_t scan_pb_tag(const char* in,size_t len, size_t* fieldno,unsigned char* type) __PURE;
511
512 /* Then, depending on the field number, validate the type and call the
513 * corresponding of these functions to parse the value */
514-size_t scan_pb_type0_int(const char* in,size_t len,unsigned long long* l) __pure__;
515-size_t scan_pb_type0_sint(const char* in,size_t len,signed long long* l) __pure__;
516-size_t scan_pb_type1_double(const char* in,size_t len,double* d) __pure__;
517-size_t scan_pb_type1_fixed64(const char* in,size_t len,uint64_t* b) __pure__;
518+size_t scan_pb_type0_int(const char* in,size_t len,unsigned long long* l) __PURE;
519+size_t scan_pb_type0_sint(const char* in,size_t len,signed long long* l) __PURE;
520+size_t scan_pb_type1_double(const char* in,size_t len,double* d) __PURE;
521+size_t scan_pb_type1_fixed64(const char* in,size_t len,uint64_t* b) __PURE;
522 /* NOTE: scan_pb_type2_stringlen only parses the length of the string,
523 * not the string itself. It will return the number of bytes parsed in
524 * the length, then set slen to the value of the length integer it just
525@@ -141,9 +147,9 @@ size_t scan_pb_type1_fixed64(const char*
526 * parsing early without having to read and allocate memory for the rest
527 * (potentially gigabytes) of the data announced by one unreasonable
528 * string length value. */
529-size_t scan_pb_type2_stringlen(const char* in,size_t len,const char** string, size_t* slen) __pure__;
530-size_t scan_pb_type5_float(const char* in,size_t len,float* f) __pure__;
531-size_t scan_pb_type5_fixed32(const char* in,size_t len,uint32_t* b) __pure__;
532+size_t scan_pb_type2_stringlen(const char* in,size_t len,const char** string, size_t* slen) __PURE;
533+size_t scan_pb_type5_float(const char* in,size_t len,float* f) __PURE;
534+size_t scan_pb_type5_fixed32(const char* in,size_t len,uint32_t* b) __PURE;
535
536 /* parse a netstring, input buffer is in (len bytes).
537 * if parsing is successful:
538@@ -153,7 +159,7 @@ size_t scan_pb_type5_fixed32(const char*
539 * return 0
540 * Note: *dest will point inside the input buffer!
541 */
542-size_t scan_netstring(const char* in,size_t len,char** dest,size_t* slen) __pure__;
543+size_t scan_netstring(const char* in,size_t len,char** dest,size_t* slen) __PURE;
544
545 /* internal function that might be useful independently */
546 /* convert from hex ASCII, return 0 to 15 for success or -1 for failure */
547--- a/scan/scan_httpdate.c
548+++ b/scan/scan_httpdate.c
549@@ -1,5 +1,4 @@
550 #define _GNU_SOURCE
551-#define __deprecated__
552 #include "scan.h"
553 #include "byte.h"
554 #include "case.h"
555--- a/scan/scan_iso8601.c
556+++ b/scan/scan_iso8601.c
557@@ -1,5 +1,4 @@
558 #define _GNU_SOURCE
559-#define __deprecated__
560 #include "scan.h"
561 #include "byte.h"
562 #include "case.h"