annotate lib/inttostr.h @ 10375:f96e845fc36d

Avoid some "gcc -pedantic" warnings.
author Bruno Haible <bruno@clisp.org>
date Sat, 30 Aug 2008 03:09:15 +0200
parents 96771d88f037
children b5e42ef33b49
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4983
1ade121b7fb9 New module inttostr.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
1 /* inttostr.h -- convert integers to printable strings
1ade121b7fb9 New module inttostr.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
2
7162
19c2e5121b2f Add and change modules to make it easier for coreutils to use
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
3 Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Free Software
19c2e5121b2f Add and change modules to make it easier for coreutils to use
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
4 Foundation, Inc.
4983
1ade121b7fb9 New module inttostr.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
5
9309
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 7543
diff changeset
6 This program is free software: you can redistribute it and/or modify
4983
1ade121b7fb9 New module inttostr.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
7 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: 7543
diff changeset
8 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: 7543
diff changeset
9 (at your option) any later version.
4983
1ade121b7fb9 New module inttostr.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
10
1ade121b7fb9 New module inttostr.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
11 This program is distributed in the hope that it will be useful,
1ade121b7fb9 New module inttostr.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
1ade121b7fb9 New module inttostr.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1ade121b7fb9 New module inttostr.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
14 GNU General Public License for more details.
1ade121b7fb9 New module inttostr.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
15
1ade121b7fb9 New module inttostr.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
9309
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 7543
diff changeset
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
4983
1ade121b7fb9 New module inttostr.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
18
1ade121b7fb9 New module inttostr.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
19 /* Written by Paul Eggert */
1ade121b7fb9 New module inttostr.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
20
7162
19c2e5121b2f Add and change modules to make it easier for coreutils to use
Paul Eggert <eggert@cs.ucla.edu>
parents: 6275
diff changeset
21 #include <stdint.h>
6275
fd0ccce602e4 Sync from coreutils.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6259
diff changeset
22 #include <sys/types.h>
4983
1ade121b7fb9 New module inttostr.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
23
5691
ec62790f0938 Factor int-properties macros into a single file, except for
Paul Eggert <eggert@cs.ucla.edu>
parents: 5003
diff changeset
24 #include "intprops.h"
4983
1ade121b7fb9 New module inttostr.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
25
10315
96771d88f037 ensure that return value of uinttostr et al are not ignored
Jim Meyering <meyering@redhat.com>
parents: 9309
diff changeset
26 #ifndef __GNUC_PREREQ
96771d88f037 ensure that return value of uinttostr et al are not ignored
Jim Meyering <meyering@redhat.com>
parents: 9309
diff changeset
27 # if defined __GNUC__ && defined __GNUC_MINOR__
96771d88f037 ensure that return value of uinttostr et al are not ignored
Jim Meyering <meyering@redhat.com>
parents: 9309
diff changeset
28 # define __GNUC_PREREQ(maj, min) \
96771d88f037 ensure that return value of uinttostr et al are not ignored
Jim Meyering <meyering@redhat.com>
parents: 9309
diff changeset
29 ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
96771d88f037 ensure that return value of uinttostr et al are not ignored
Jim Meyering <meyering@redhat.com>
parents: 9309
diff changeset
30 # else
96771d88f037 ensure that return value of uinttostr et al are not ignored
Jim Meyering <meyering@redhat.com>
parents: 9309
diff changeset
31 # define __GNUC_PREREQ(maj, min) 0
96771d88f037 ensure that return value of uinttostr et al are not ignored
Jim Meyering <meyering@redhat.com>
parents: 9309
diff changeset
32 # endif
96771d88f037 ensure that return value of uinttostr et al are not ignored
Jim Meyering <meyering@redhat.com>
parents: 9309
diff changeset
33 #endif
96771d88f037 ensure that return value of uinttostr et al are not ignored
Jim Meyering <meyering@redhat.com>
parents: 9309
diff changeset
34
96771d88f037 ensure that return value of uinttostr et al are not ignored
Jim Meyering <meyering@redhat.com>
parents: 9309
diff changeset
35 #if __GNUC_PREREQ (3,4)
96771d88f037 ensure that return value of uinttostr et al are not ignored
Jim Meyering <meyering@redhat.com>
parents: 9309
diff changeset
36 # undef __attribute_warn_unused_result__
96771d88f037 ensure that return value of uinttostr et al are not ignored
Jim Meyering <meyering@redhat.com>
parents: 9309
diff changeset
37 # define __attribute_warn_unused_result__ \
96771d88f037 ensure that return value of uinttostr et al are not ignored
Jim Meyering <meyering@redhat.com>
parents: 9309
diff changeset
38 __attribute__ ((__warn_unused_result__))
96771d88f037 ensure that return value of uinttostr et al are not ignored
Jim Meyering <meyering@redhat.com>
parents: 9309
diff changeset
39 #else
96771d88f037 ensure that return value of uinttostr et al are not ignored
Jim Meyering <meyering@redhat.com>
parents: 9309
diff changeset
40 # define __attribute_warn_unused_result__ /* empty */
96771d88f037 ensure that return value of uinttostr et al are not ignored
Jim Meyering <meyering@redhat.com>
parents: 9309
diff changeset
41 #endif
96771d88f037 ensure that return value of uinttostr et al are not ignored
Jim Meyering <meyering@redhat.com>
parents: 9309
diff changeset
42
96771d88f037 ensure that return value of uinttostr et al are not ignored
Jim Meyering <meyering@redhat.com>
parents: 9309
diff changeset
43 char *offtostr (off_t, char *) __attribute_warn_unused_result__;
96771d88f037 ensure that return value of uinttostr et al are not ignored
Jim Meyering <meyering@redhat.com>
parents: 9309
diff changeset
44 char *imaxtostr (intmax_t, char *) __attribute_warn_unused_result__;
96771d88f037 ensure that return value of uinttostr et al are not ignored
Jim Meyering <meyering@redhat.com>
parents: 9309
diff changeset
45 char *umaxtostr (uintmax_t, char *) __attribute_warn_unused_result__;
96771d88f037 ensure that return value of uinttostr et al are not ignored
Jim Meyering <meyering@redhat.com>
parents: 9309
diff changeset
46 char *uinttostr (unsigned int, char *) __attribute_warn_unused_result__;