Sun Sep 21 16:59:46 2008 UTC ()
add missing attributes to the remaining calls, even the ones that gcc has
builtin attributes for (for symmetry and consistency). In the future this
might change to use compiler-neutral macros. On the other hand I don't
know of any other compiler that provides other macros with similar
functionality, so why bother?


(christos)
diff -r1.1 -r1.2 src/include/monetary.h
diff -r1.72 -r1.73 src/include/stdio.h
diff -r1.36 -r1.37 src/include/time.h

cvs diff -r1.1 -r1.2 src/include/monetary.h (expand / switch to unified diff)

--- src/include/monetary.h 2005/04/03 20:09:29 1.1
+++ src/include/monetary.h 2008/09/21 16:59:46 1.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: monetary.h,v 1.1 2005/04/03 20:09:29 christos Exp $ */ 1/* $NetBSD: monetary.h,v 1.2 2008/09/21 16:59:46 christos Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2001 Alexey Zelkin <phantom@FreeBSD.org> 4 * Copyright (c) 2001 Alexey Zelkin <phantom@FreeBSD.org>
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -35,17 +35,18 @@ @@ -35,17 +35,18 @@
35#include <machine/ansi.h> 35#include <machine/ansi.h>
36 36
37#ifdef _BSD_SIZE_T_ 37#ifdef _BSD_SIZE_T_
38typedef _BSD_SIZE_T_ size_t; 38typedef _BSD_SIZE_T_ size_t;
39#undef _BSD_SIZE_T_ 39#undef _BSD_SIZE_T_
40#endif 40#endif
41 41
42#ifdef _BSD_SSIZE_T_ 42#ifdef _BSD_SSIZE_T_
43typedef _BSD_SSIZE_T_ ssize_t; 43typedef _BSD_SSIZE_T_ ssize_t;
44#undef _BSD_SSIZE_T_ 44#undef _BSD_SSIZE_T_
45#endif 45#endif
46 46
47__BEGIN_DECLS 47__BEGIN_DECLS
48ssize_t strfmon(char * __restrict, size_t, const char * __restrict, ...); 48ssize_t strfmon(char * __restrict, size_t, const char * __restrict, ...)
 49 __attribute__((__format__(__strfmon__, 3, 4)));
49__END_DECLS 50__END_DECLS
50 51
51#endif /* !_MONETARY_H_ */ 52#endif /* !_MONETARY_H_ */

cvs diff -r1.72 -r1.73 src/include/stdio.h (expand / switch to unified diff)

--- src/include/stdio.h 2008/08/04 17:08:49 1.72
+++ src/include/stdio.h 2008/09/21 16:59:46 1.73
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: stdio.h,v 1.72 2008/08/04 17:08:49 matt Exp $ */ 1/* $NetBSD: stdio.h,v 1.73 2008/09/21 16:59:46 christos Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1990, 1993 4 * Copyright (c) 1990, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to Berkeley by 7 * This code is derived from software contributed to Berkeley by
8 * Chris Torek. 8 * Chris Torek.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -211,61 +211,70 @@ __END_DECLS @@ -211,61 +211,70 @@ __END_DECLS
211/* 211/*
212 * Functions defined in ANSI C standard. 212 * Functions defined in ANSI C standard.
213 */ 213 */
214__BEGIN_DECLS 214__BEGIN_DECLS
215void clearerr(FILE *); 215void clearerr(FILE *);
216int fclose(FILE *); 216int fclose(FILE *);
217int feof(FILE *); 217int feof(FILE *);
218int ferror(FILE *); 218int ferror(FILE *);
219int fflush(FILE *); 219int fflush(FILE *);
220int fgetc(FILE *); 220int fgetc(FILE *);
221int fgetpos(FILE * __restrict, fpos_t * __restrict); 221int fgetpos(FILE * __restrict, fpos_t * __restrict);
222char *fgets(char * __restrict, int, FILE * __restrict); 222char *fgets(char * __restrict, int, FILE * __restrict);
223FILE *fopen(const char * __restrict , const char * __restrict); 223FILE *fopen(const char * __restrict , const char * __restrict);
224int fprintf(FILE * __restrict , const char * __restrict, ...); 224int fprintf(FILE * __restrict , const char * __restrict, ...)
 225 __attribute__((__format__(__printf__, 2, 3)));
225int fputc(int, FILE *); 226int fputc(int, FILE *);
226int fputs(const char * __restrict, FILE * __restrict); 227int fputs(const char * __restrict, FILE * __restrict);
227size_t fread(void * __restrict, size_t, size_t, FILE * __restrict); 228size_t fread(void * __restrict, size_t, size_t, FILE * __restrict);
228FILE *freopen(const char * __restrict, const char * __restrict, 229FILE *freopen(const char * __restrict, const char * __restrict,
229 FILE * __restrict); 230 FILE * __restrict);
230int fscanf(FILE * __restrict, const char * __restrict, ...); 231int fscanf(FILE * __restrict, const char * __restrict, ...)
 232 __attribute__((__format__(__scanf__, 2, 3)));
231int fseek(FILE *, long, int); 233int fseek(FILE *, long, int);
232int fsetpos(FILE *, const fpos_t *); 234int fsetpos(FILE *, const fpos_t *);
233long ftell(FILE *); 235long ftell(FILE *);
234size_t fwrite(const void * __restrict, size_t, size_t, FILE * __restrict); 236size_t fwrite(const void * __restrict, size_t, size_t, FILE * __restrict);
235int getc(FILE *); 237int getc(FILE *);
236int getchar(void); 238int getchar(void);
237void perror(const char *); 239void perror(const char *);
238int printf(const char * __restrict, ...); 240int printf(const char * __restrict, ...)
 241 __attribute__((__format__(__printf__, 1, 2)));
239int putc(int, FILE *); 242int putc(int, FILE *);
240int putchar(int); 243int putchar(int);
241int puts(const char *); 244int puts(const char *);
242int remove(const char *); 245int remove(const char *);
243void rewind(FILE *); 246void rewind(FILE *);
244int scanf(const char * __restrict, ...); 247int scanf(const char * __restrict, ...)
 248 __attribute__((__format__(__scanf__, 1, 2)));
245void setbuf(FILE * __restrict, char * __restrict); 249void setbuf(FILE * __restrict, char * __restrict);
246int setvbuf(FILE * __restrict, char * __restrict, int, size_t); 250int setvbuf(FILE * __restrict, char * __restrict, int, size_t);
247int sscanf(const char * __restrict, const char * __restrict, ...); 251int sscanf(const char * __restrict, const char * __restrict, ...)
 252 __attribute__((__format__(__scanf__, 2, 3)));
248FILE *tmpfile(void); 253FILE *tmpfile(void);
249int ungetc(int, FILE *); 254int ungetc(int, FILE *);
250int vfprintf(FILE * __restrict, const char * __restrict, _BSD_VA_LIST_); 255int vfprintf(FILE * __restrict, const char * __restrict, _BSD_VA_LIST_)
251int vprintf(const char * __restrict, _BSD_VA_LIST_); 256 __attribute__((__format__(__printf__, 2, 0)));
 257int vprintf(const char * __restrict, _BSD_VA_LIST_)
 258 __attribute__((__format__(__printf__, 1, 0)));
252 259
253#ifndef __AUDIT__ 260#ifndef __AUDIT__
254char *gets(char *); 261char *gets(char *);
255int sprintf(char * __restrict, const char * __restrict, ...); 262int sprintf(char * __restrict, const char * __restrict, ...)
 263 __attribute__((__format__(__printf__, 2, 3)));
256char *tmpnam(char *); 264char *tmpnam(char *);
257int vsprintf(char * __restrict, const char * __restrict, 265int vsprintf(char * __restrict, const char * __restrict,
258 _BSD_VA_LIST_); 266 _BSD_VA_LIST_)
 267 __attribute__((__format__(__printf__, 2, 0)));
259#endif 268#endif
260 269
261#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) 270#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
262int rename (const char *, const char *) __RENAME(__posix_rename); 271int rename (const char *, const char *) __RENAME(__posix_rename);
263#else 272#else
264int rename (const char *, const char *); 273int rename (const char *, const char *);
265#endif 274#endif
266__END_DECLS 275__END_DECLS
267 276
268/* 277/*
269 * IEEE Std 1003.1-90 278 * IEEE Std 1003.1-90
270 */ 279 */
271#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ 280#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
@@ -312,30 +321,30 @@ FILE *popen(const char *, const char *); @@ -312,30 +321,30 @@ FILE *popen(const char *, const char *);
312__END_DECLS 321__END_DECLS
313#endif 322#endif
314 323
315/* 324/*
316 * Functions defined in ISO XPG4.2, ISO C99, POSIX 1003.1-2001 or later. 325 * Functions defined in ISO XPG4.2, ISO C99, POSIX 1003.1-2001 or later.
317 */ 326 */
318#if ((__STDC_VERSION__ - 0) >= 199901L) || \ 327#if ((__STDC_VERSION__ - 0) >= 199901L) || \
319 ((_POSIX_C_SOURCE - 0) >= 200112L) || \ 328 ((_POSIX_C_SOURCE - 0) >= 200112L) || \
320 (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \ 329 (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
321 ((_XOPEN_SOURCE - 0) >= 500) || \ 330 ((_XOPEN_SOURCE - 0) >= 500) || \
322 defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE) 331 defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE)
323__BEGIN_DECLS 332__BEGIN_DECLS
324int snprintf(char * __restrict, size_t, const char * __restrict, ...) 333int snprintf(char * __restrict, size_t, const char * __restrict, ...)
325 __attribute__((__format__(__printf__, 3, 4))); 334 __attribute__((__format__(__printf__, 3, 4)));
326int vsnprintf(char * __restrict, size_t, const char * __restrict, 335int vsnprintf(char * __restrict, size_t, const char * __restrict,
327 _BSD_VA_LIST_) 336 _BSD_VA_LIST_)
328 __attribute__((__format__(__printf__, 3, 0))); 337 __attribute__((__format__(__printf__, 3, 0)));
329__END_DECLS 338__END_DECLS
330#endif 339#endif
331 340
332/* 341/*
333 * Functions defined in XPG4.2. 342 * Functions defined in XPG4.2.
334 */ 343 */
335#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE) 344#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
336__BEGIN_DECLS 345__BEGIN_DECLS
337int getw(FILE *); 346int getw(FILE *);
338int putw(int, FILE *); 347int putw(int, FILE *);
339 348
340#ifndef __AUDIT__ 349#ifndef __AUDIT__
341char *tempnam(const char *, const char *); 350char *tempnam(const char *, const char *);
@@ -356,59 +365,59 @@ typedef __off_t off_t; @@ -356,59 +365,59 @@ typedef __off_t off_t;
356__BEGIN_DECLS 365__BEGIN_DECLS
357int fseeko(FILE *, off_t, int); 366int fseeko(FILE *, off_t, int);
358off_t ftello(FILE *); 367off_t ftello(FILE *);
359__END_DECLS 368__END_DECLS
360#endif /* _XOPEN_SOURCE >= 500 || _LARGEFILE_SOURCE || _NETBSD_SOURCE */ 369#endif /* _XOPEN_SOURCE >= 500 || _LARGEFILE_SOURCE || _NETBSD_SOURCE */
361 370
362/* 371/*
363 * Functions defined in ISO C99. Still put under _NETBSD_SOURCE due to 372 * Functions defined in ISO C99. Still put under _NETBSD_SOURCE due to
364 * backward compatible. 373 * backward compatible.
365 */ 374 */
366#if defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE) 375#if defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE)
367__BEGIN_DECLS 376__BEGIN_DECLS
368int vscanf(const char * __restrict, _BSD_VA_LIST_) 377int vscanf(const char * __restrict, _BSD_VA_LIST_)
369 __attribute__((__format__(__scanf__, 1, 0))); 378 __attribute__((__format__(__scanf__, 1, 0)));
370int vfscanf(FILE * __restrict, const char * __restrict, _BSD_VA_LIST_) 379int vfscanf(FILE * __restrict, const char * __restrict, _BSD_VA_LIST_)
371 __attribute__((__format__(__scanf__, 2, 0))); 380 __attribute__((__format__(__scanf__, 2, 0)));
372int vsscanf(const char * __restrict, const char * __restrict, 381int vsscanf(const char * __restrict, const char * __restrict,
373 _BSD_VA_LIST_) 382 _BSD_VA_LIST_)
374 __attribute__((__format__(__scanf__, 2, 0))); 383 __attribute__((__format__(__scanf__, 2, 0)));
375__END_DECLS 384__END_DECLS
376#endif /* _ISOC99_SOURCE || _NETBSD_SOURCE */ 385#endif /* _ISOC99_SOURCE || _NETBSD_SOURCE */
377 386
378/* 387/*
379 * Routines that are purely local. 388 * Routines that are purely local.
380 */ 389 */
381#if defined(_NETBSD_SOURCE) 390#if defined(_NETBSD_SOURCE)
382 391
383#define FPARSELN_UNESCESC 0x01 392#define FPARSELN_UNESCESC 0x01
384#define FPARSELN_UNESCCONT 0x02 393#define FPARSELN_UNESCCONT 0x02
385#define FPARSELN_UNESCCOMM 0x04 394#define FPARSELN_UNESCCOMM 0x04
386#define FPARSELN_UNESCREST 0x08 395#define FPARSELN_UNESCREST 0x08
387#define FPARSELN_UNESCALL 0x0f 396#define FPARSELN_UNESCALL 0x0f
388 397
389__BEGIN_DECLS 398__BEGIN_DECLS
390int asprintf(char ** __restrict, const char * __restrict, ...) 399int asprintf(char ** __restrict, const char * __restrict, ...)
391 __attribute__((__format__(__printf__, 2, 3))); 400 __attribute__((__format__(__printf__, 2, 3)));
392char *fgetln(FILE * __restrict, size_t * __restrict); 401char *fgetln(FILE * __restrict, size_t * __restrict);
393char *fparseln(FILE *, size_t *, size_t *, const char[3], int); 402char *fparseln(FILE *, size_t *, size_t *, const char[3], int);
394int fpurge(FILE *); 403int fpurge(FILE *);
395void setbuffer(FILE *, char *, int); 404void setbuffer(FILE *, char *, int);
396int setlinebuf(FILE *); 405int setlinebuf(FILE *);
397int vasprintf(char ** __restrict, const char * __restrict, 406int vasprintf(char ** __restrict, const char * __restrict,
398 _BSD_VA_LIST_) 407 _BSD_VA_LIST_)
399 __attribute__((__format__(__printf__, 2, 0))); 408 __attribute__((__format__(__printf__, 2, 0)));
400const char *fmtcheck(const char *, const char *) 409const char *fmtcheck(const char *, const char *)
401 __attribute__((__format_arg__(2))); 410 __attribute__((__format_arg__(2)));
402__END_DECLS 411__END_DECLS
403 412
404/* 413/*
405 * Stdio function-access interface. 414 * Stdio function-access interface.
406 */ 415 */
407__BEGIN_DECLS 416__BEGIN_DECLS
408FILE *funopen(const void *, 417FILE *funopen(const void *,
409 int (*)(void *, char *, int), 418 int (*)(void *, char *, int),
410 int (*)(void *, const char *, int), 419 int (*)(void *, const char *, int),
411 fpos_t (*)(void *, fpos_t, int), 420 fpos_t (*)(void *, fpos_t, int),
412 int (*)(void *)); 421 int (*)(void *));
413__END_DECLS 422__END_DECLS
414#define fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0) 423#define fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0)

cvs diff -r1.36 -r1.37 src/include/time.h (expand / switch to unified diff)

--- src/include/time.h 2008/04/01 19:23:28 1.36
+++ src/include/time.h 2008/09/21 16:59:46 1.37
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: time.h,v 1.36 2008/04/01 19:23:28 drochner Exp $ */ 1/* $NetBSD: time.h,v 1.37 2008/09/21 16:59:46 christos Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1989, 1993 4 * Copyright (c) 1989, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * (c) UNIX System Laboratories, Inc. 6 * (c) UNIX System Laboratories, Inc.
7 * All or some portions of this file are derived from material licensed 7 * All or some portions of this file are derived from material licensed
8 * to the University of California by American Telephone and Telegraph 8 * to the University of California by American Telephone and Telegraph
9 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 9 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
10 * the permission of UNIX System Laboratories, Inc. 10 * the permission of UNIX System Laboratories, Inc.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions 13 * modification, are permitted provided that the following conditions
14 * are met: 14 * are met:
@@ -85,27 +85,28 @@ struct tm { @@ -85,27 +85,28 @@ struct tm {
85 long tm_gmtoff; /* offset from UTC in seconds */ 85 long tm_gmtoff; /* offset from UTC in seconds */
86 __aconst char *tm_zone; /* timezone abbreviation */ 86 __aconst char *tm_zone; /* timezone abbreviation */
87}; 87};
88 88
89__BEGIN_DECLS 89__BEGIN_DECLS
90char *asctime(const struct tm *); 90char *asctime(const struct tm *);
91clock_t clock(void); 91clock_t clock(void);
92char *ctime(const time_t *); 92char *ctime(const time_t *);
93double difftime(time_t, time_t); 93double difftime(time_t, time_t);
94struct tm *gmtime(const time_t *); 94struct tm *gmtime(const time_t *);
95struct tm *localtime(const time_t *); 95struct tm *localtime(const time_t *);
96time_t mktime(struct tm *); 96time_t mktime(struct tm *);
97size_t strftime(char * __restrict, size_t, const char * __restrict, 97size_t strftime(char * __restrict, size_t, const char * __restrict,
98 const struct tm * __restrict); 98 const struct tm * __restrict)
 99 __attribute__((__format__(__strftime__, 3, 0)));
99time_t time(time_t *); 100time_t time(time_t *);
100 101
101#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ 102#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
102 defined(_NETBSD_SOURCE) 103 defined(_NETBSD_SOURCE)
103#ifndef __LIBC12_SOURCE__ 104#ifndef __LIBC12_SOURCE__
104/* 105/*
105 * CLK_TCK uses libc's internal __sysconf() to retrieve the machine's 106 * CLK_TCK uses libc's internal __sysconf() to retrieve the machine's
106 * HZ. The value of _SC_CLK_TCK is 39 -- we hard code it so we do not 107 * HZ. The value of _SC_CLK_TCK is 39 -- we hard code it so we do not
107 * need to include unistd.h 108 * need to include unistd.h
108 */ 109 */
109long __sysconf(int); 110long __sysconf(int);
110#define CLK_TCK (__sysconf(39)) 111#define CLK_TCK (__sysconf(39))
111#endif 112#endif