Mercurial > hg > octave-shane > gnulib-hg
annotate modules/math @ 12726:d6da6e5f2f62
math: add portability warnings for classification macros
For interfaces which are defined to exist only as macros, implement
the proper magic needed to warn if the corresponding gnulib module was
not in use. This solution avoids promoting arguments unnecessarily,
to allow reuse in case gnulib ever implements fpclassify, since
fpclassify(1e-40f) is different than fpclassify(1e-40).
* modules/math (Depends-on): Add warn-on-use.
(Makefile.am): Provide new substitutions.
* m4/math_h.m4 (gl_MATH_H): Require inline.
* lib/math.in.h (_GL_WARN_REAL_FLOATING_DECL)
(_GL_WARN_REAL_FLOATING_IMPL): New helper macros.
(isfinite, isinf, isnan, signbit) [GNULIB_POSIXCHECK]: Use them to
implement warnings.
Signed-off-by: Eric Blake <ebb9@byu.net>
author | Eric Blake <ebb9@byu.net> |
---|---|
date | Thu, 31 Dec 2009 13:48:15 -0700 |
parents | f7842310a565 |
children | 73d9dd27dc41 |
rev | line source |
---|---|
8186
c115624bf99a
New module 'math'. <math.h> replaces mathl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1 Description: |
c115624bf99a
New module 'math'. <math.h> replaces mathl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2 A GNU-like <math.h>. |
c115624bf99a
New module 'math'. <math.h> replaces mathl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3 |
c115624bf99a
New module 'math'. <math.h> replaces mathl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4 Files: |
9255
590a8ac4bca4
Rename math_.h to math.in.h.
Bruno Haible <bruno@clisp.org>
parents:
8995
diff
changeset
|
5 lib/math.in.h |
8186
c115624bf99a
New module 'math'. <math.h> replaces mathl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6 m4/math_h.m4 |
c115624bf99a
New module 'math'. <math.h> replaces mathl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
7 |
c115624bf99a
New module 'math'. <math.h> replaces mathl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8 Depends-on: |
12726
d6da6e5f2f62
math: add portability warnings for classification macros
Eric Blake <ebb9@byu.net>
parents:
12422
diff
changeset
|
9 arg-nonnull |
8995
1025663f7658
* m4/include_next.m4 (gl_INCLUDE_NEXT): Define and AC_SUBST
Paul Eggert <eggert@cs.ucla.edu>
parents:
8819
diff
changeset
|
10 include_next |
8186
c115624bf99a
New module 'math'. <math.h> replaces mathl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
11 link-warning |
12726
d6da6e5f2f62
math: add portability warnings for classification macros
Eric Blake <ebb9@byu.net>
parents:
12422
diff
changeset
|
12 warn-on-use |
8186
c115624bf99a
New module 'math'. <math.h> replaces mathl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
13 |
c115624bf99a
New module 'math'. <math.h> replaces mathl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
14 configure.ac: |
c115624bf99a
New module 'math'. <math.h> replaces mathl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
15 gl_MATH_H |
c115624bf99a
New module 'math'. <math.h> replaces mathl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
16 |
c115624bf99a
New module 'math'. <math.h> replaces mathl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
17 Makefile.am: |
c115624bf99a
New module 'math'. <math.h> replaces mathl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
18 BUILT_SOURCES += math.h |
c115624bf99a
New module 'math'. <math.h> replaces mathl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
19 |
c115624bf99a
New module 'math'. <math.h> replaces mathl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
20 # We need the following in order to create <math.h> when the system |
c115624bf99a
New module 'math'. <math.h> replaces mathl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
21 # doesn't have one that works with the given compiler. |
12726
d6da6e5f2f62
math: add portability warnings for classification macros
Eric Blake <ebb9@byu.net>
parents:
12422
diff
changeset
|
22 math.h: math.in.h $(LINK_WARNING_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H) |
11868
67c2b22aff08
annotate automake snippets with $(AM_V_GEN) and $(AM_V_at)
Jim Meyering <meyering@redhat.com>
parents:
11583
diff
changeset
|
23 $(AM_V_GEN)rm -f $@-t $@ && \ |
8186
c115624bf99a
New module 'math'. <math.h> replaces mathl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
24 { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ |
10836
08a197428e92
Attempt to work around another AIX 5.3, 6.1 compiler bug with include_next.
Bruno Haible <bruno@clisp.org>
parents:
10667
diff
changeset
|
25 sed -e 's|@''INCLUDE_NEXT_AS_FIRST_DIRECTIVE''@|$(INCLUDE_NEXT_AS_FIRST_DIRECTIVE)|g' \ |
10375
f96e845fc36d
Avoid some "gcc -pedantic" warnings.
Bruno Haible <bruno@clisp.org>
parents:
10287
diff
changeset
|
26 -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ |
11583
dc80f2cc1327
Second attempt to work around an AIX 5.3, 6.1 compiler bug with include_next.
Eric Blake <ebb9@byu.net>
parents:
10836
diff
changeset
|
27 -e 's|@''NEXT_AS_FIRST_DIRECTIVE_MATH_H''@|$(NEXT_AS_FIRST_DIRECTIVE_MATH_H)|g' \ |
9295 | 28 -e 's|@''GNULIB_CEILF''@|$(GNULIB_CEILF)|g' \ |
9297 | 29 -e 's|@''GNULIB_CEILL''@|$(GNULIB_CEILL)|g' \ |
9291 | 30 -e 's|@''GNULIB_FLOORF''@|$(GNULIB_FLOORF)|g' \ |
9293 | 31 -e 's|@''GNULIB_FLOORL''@|$(GNULIB_FLOORL)|g' \ |
8491 | 32 -e 's|@''GNULIB_FREXP''@|$(GNULIB_FREXP)|g' \ |
8497 | 33 -e 's|@''GNULIB_FREXPL''@|$(GNULIB_FREXPL)|g' \ |
9423
fa47aa8bb105
Use REPLACE_ISFINITE instead of HAVE_DECL_ISFINITE.
Bruno Haible <bruno@clisp.org>
parents:
9420
diff
changeset
|
34 -e 's|@''GNULIB_ISFINITE''@|$(GNULIB_ISFINITE)|g' \ |
10287 | 35 -e 's|@''GNULIB_ISINF''@|$(GNULIB_ISINF)|g' \ |
10267 | 36 -e 's|@''GNULIB_ISNAN''@|$(GNULIB_ISNAN)|g' \ |
10667
678640901735
Move the isnanf(), isnand(), isnanl() declarations to <math.h>.
Bruno Haible <bruno@clisp.org>
parents:
10375
diff
changeset
|
37 -e 's|@''GNULIB_ISNANF''@|$(GNULIB_ISNANF)|g' \ |
678640901735
Move the isnanf(), isnand(), isnanl() declarations to <math.h>.
Bruno Haible <bruno@clisp.org>
parents:
10375
diff
changeset
|
38 -e 's|@''GNULIB_ISNAND''@|$(GNULIB_ISNAND)|g' \ |
678640901735
Move the isnanf(), isnand(), isnanl() declarations to <math.h>.
Bruno Haible <bruno@clisp.org>
parents:
10375
diff
changeset
|
39 -e 's|@''GNULIB_ISNANL''@|$(GNULIB_ISNANL)|g' \ |
8588 | 40 -e 's|@''GNULIB_LDEXPL''@|$(GNULIB_LDEXPL)|g' \ |
8186
c115624bf99a
New module 'math'. <math.h> replaces mathl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
41 -e 's|@''GNULIB_MATHL''@|$(GNULIB_MATHL)|g' \ |
9375
96fea5b2eb11
Implement 'round', 'roundf', 'roundl' modules.
Ben Pfaff <blp@cs.stanford.edu>
parents:
9297
diff
changeset
|
42 -e 's|@''GNULIB_ROUND''@|$(GNULIB_ROUND)|g' \ |
96fea5b2eb11
Implement 'round', 'roundf', 'roundl' modules.
Ben Pfaff <blp@cs.stanford.edu>
parents:
9297
diff
changeset
|
43 -e 's|@''GNULIB_ROUNDF''@|$(GNULIB_ROUNDF)|g' \ |
96fea5b2eb11
Implement 'round', 'roundf', 'roundl' modules.
Ben Pfaff <blp@cs.stanford.edu>
parents:
9297
diff
changeset
|
44 -e 's|@''GNULIB_ROUNDL''@|$(GNULIB_ROUNDL)|g' \ |
8652 | 45 -e 's|@''GNULIB_SIGNBIT''@|$(GNULIB_SIGNBIT)|g' \ |
9282 | 46 -e 's|@''GNULIB_TRUNC''@|$(GNULIB_TRUNC)|g' \ |
9285 | 47 -e 's|@''GNULIB_TRUNCF''@|$(GNULIB_TRUNCF)|g' \ |
9287 | 48 -e 's|@''GNULIB_TRUNCL''@|$(GNULIB_TRUNCL)|g' \ |
10667
678640901735
Move the isnanf(), isnand(), isnanl() declarations to <math.h>.
Bruno Haible <bruno@clisp.org>
parents:
10375
diff
changeset
|
49 -e 's|@''HAVE_ISNANF''@|$(HAVE_ISNANF)|g' \ |
678640901735
Move the isnanf(), isnand(), isnanl() declarations to <math.h>.
Bruno Haible <bruno@clisp.org>
parents:
10375
diff
changeset
|
50 -e 's|@''HAVE_ISNAND''@|$(HAVE_ISNAND)|g' \ |
678640901735
Move the isnanf(), isnand(), isnanl() declarations to <math.h>.
Bruno Haible <bruno@clisp.org>
parents:
10375
diff
changeset
|
51 -e 's|@''HAVE_ISNANL''@|$(HAVE_ISNANL)|g' \ |
8359
d8d194025f40
Provide the option to declare the mathl functions also when the 'mathl'
Bruno Haible <bruno@clisp.org>
parents:
8186
diff
changeset
|
52 -e 's|@''HAVE_DECL_ACOSL''@|$(HAVE_DECL_ACOSL)|g' \ |
d8d194025f40
Provide the option to declare the mathl functions also when the 'mathl'
Bruno Haible <bruno@clisp.org>
parents:
8186
diff
changeset
|
53 -e 's|@''HAVE_DECL_ASINL''@|$(HAVE_DECL_ASINL)|g' \ |
d8d194025f40
Provide the option to declare the mathl functions also when the 'mathl'
Bruno Haible <bruno@clisp.org>
parents:
8186
diff
changeset
|
54 -e 's|@''HAVE_DECL_ATANL''@|$(HAVE_DECL_ATANL)|g' \ |
d8d194025f40
Provide the option to declare the mathl functions also when the 'mathl'
Bruno Haible <bruno@clisp.org>
parents:
8186
diff
changeset
|
55 -e 's|@''HAVE_DECL_COSL''@|$(HAVE_DECL_COSL)|g' \ |
d8d194025f40
Provide the option to declare the mathl functions also when the 'mathl'
Bruno Haible <bruno@clisp.org>
parents:
8186
diff
changeset
|
56 -e 's|@''HAVE_DECL_EXPL''@|$(HAVE_DECL_EXPL)|g' \ |
d8d194025f40
Provide the option to declare the mathl functions also when the 'mathl'
Bruno Haible <bruno@clisp.org>
parents:
8186
diff
changeset
|
57 -e 's|@''HAVE_DECL_FREXPL''@|$(HAVE_DECL_FREXPL)|g' \ |
d8d194025f40
Provide the option to declare the mathl functions also when the 'mathl'
Bruno Haible <bruno@clisp.org>
parents:
8186
diff
changeset
|
58 -e 's|@''HAVE_DECL_LDEXPL''@|$(HAVE_DECL_LDEXPL)|g' \ |
d8d194025f40
Provide the option to declare the mathl functions also when the 'mathl'
Bruno Haible <bruno@clisp.org>
parents:
8186
diff
changeset
|
59 -e 's|@''HAVE_DECL_LOGL''@|$(HAVE_DECL_LOGL)|g' \ |
d8d194025f40
Provide the option to declare the mathl functions also when the 'mathl'
Bruno Haible <bruno@clisp.org>
parents:
8186
diff
changeset
|
60 -e 's|@''HAVE_DECL_SINL''@|$(HAVE_DECL_SINL)|g' \ |
d8d194025f40
Provide the option to declare the mathl functions also when the 'mathl'
Bruno Haible <bruno@clisp.org>
parents:
8186
diff
changeset
|
61 -e 's|@''HAVE_DECL_SQRTL''@|$(HAVE_DECL_SQRTL)|g' \ |
d8d194025f40
Provide the option to declare the mathl functions also when the 'mathl'
Bruno Haible <bruno@clisp.org>
parents:
8186
diff
changeset
|
62 -e 's|@''HAVE_DECL_TANL''@|$(HAVE_DECL_TANL)|g' \ |
9282 | 63 -e 's|@''HAVE_DECL_TRUNC''@|$(HAVE_DECL_TRUNC)|g' \ |
9285 | 64 -e 's|@''HAVE_DECL_TRUNCF''@|$(HAVE_DECL_TRUNCF)|g' \ |
9420
9e0484f26251
Fix link errors with Sun C 5.0 on Solaris 10.
Bruno Haible <bruno@clisp.org>
parents:
9414
diff
changeset
|
65 -e 's|@''REPLACE_CEILF''@|$(REPLACE_CEILF)|g' \ |
9e0484f26251
Fix link errors with Sun C 5.0 on Solaris 10.
Bruno Haible <bruno@clisp.org>
parents:
9414
diff
changeset
|
66 -e 's|@''REPLACE_CEILL''@|$(REPLACE_CEILL)|g' \ |
9e0484f26251
Fix link errors with Sun C 5.0 on Solaris 10.
Bruno Haible <bruno@clisp.org>
parents:
9414
diff
changeset
|
67 -e 's|@''REPLACE_FLOORF''@|$(REPLACE_FLOORF)|g' \ |
9e0484f26251
Fix link errors with Sun C 5.0 on Solaris 10.
Bruno Haible <bruno@clisp.org>
parents:
9414
diff
changeset
|
68 -e 's|@''REPLACE_FLOORL''@|$(REPLACE_FLOORL)|g' \ |
8491 | 69 -e 's|@''REPLACE_FREXP''@|$(REPLACE_FREXP)|g' \ |
8547
658be4e4521a
Provide a replacement for frexpl() if the system has it but it doesn't work.
Bruno Haible <bruno@clisp.org>
parents:
8497
diff
changeset
|
70 -e 's|@''REPLACE_FREXPL''@|$(REPLACE_FREXPL)|g' \ |
9898
02bfc9acab82
Work around Solaris 10 math.h bug.
Eric Blake <ebb9@byu.net>
parents:
9645
diff
changeset
|
71 -e 's|@''REPLACE_HUGE_VAL''@|$(REPLACE_HUGE_VAL)|g' \ |
9423
fa47aa8bb105
Use REPLACE_ISFINITE instead of HAVE_DECL_ISFINITE.
Bruno Haible <bruno@clisp.org>
parents:
9420
diff
changeset
|
72 -e 's|@''REPLACE_ISFINITE''@|$(REPLACE_ISFINITE)|g' \ |
10287 | 73 -e 's|@''REPLACE_ISINF''@|$(REPLACE_ISINF)|g' \ |
10267 | 74 -e 's|@''REPLACE_ISNAN''@|$(REPLACE_ISNAN)|g' \ |
8588 | 75 -e 's|@''REPLACE_LDEXPL''@|$(REPLACE_LDEXPL)|g' \ |
9898
02bfc9acab82
Work around Solaris 10 math.h bug.
Eric Blake <ebb9@byu.net>
parents:
9645
diff
changeset
|
76 -e 's|@''REPLACE_NAN''@|$(REPLACE_NAN)|g' \ |
9465
4a3319c82e39
Use REPLACE_ROUND instead of HAVE_DECL_ROUND.
Bruno Haible <bruno@clisp.org>
parents:
9423
diff
changeset
|
77 -e 's|@''REPLACE_ROUND''@|$(REPLACE_ROUND)|g' \ |
4a3319c82e39
Use REPLACE_ROUND instead of HAVE_DECL_ROUND.
Bruno Haible <bruno@clisp.org>
parents:
9423
diff
changeset
|
78 -e 's|@''REPLACE_ROUNDF''@|$(REPLACE_ROUNDF)|g' \ |
4a3319c82e39
Use REPLACE_ROUND instead of HAVE_DECL_ROUND.
Bruno Haible <bruno@clisp.org>
parents:
9423
diff
changeset
|
79 -e 's|@''REPLACE_ROUNDL''@|$(REPLACE_ROUNDL)|g' \ |
8652 | 80 -e 's|@''REPLACE_SIGNBIT''@|$(REPLACE_SIGNBIT)|g' \ |
9645
c8174371956e
Exploit the __builtin_signbit GCC built-in.
Bruno Haible <bruno@clisp.org>
parents:
9465
diff
changeset
|
81 -e 's|@''REPLACE_SIGNBIT_USING_GCC''@|$(REPLACE_SIGNBIT_USING_GCC)|g' \ |
9913
d3f5a70dc1ba
Make truncl work on OSF/1 4.0.
Bruno Haible <bruno@clisp.org>
parents:
9898
diff
changeset
|
82 -e 's|@''REPLACE_TRUNCL''@|$(REPLACE_TRUNCL)|g' \ |
8186
c115624bf99a
New module 'math'. <math.h> replaces mathl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
83 -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ |
12422
f7842310a565
New module 'arg-nonnull'. Declare which arguments expect non-NULL values.
Bruno Haible <bruno@clisp.org>
parents:
12410
diff
changeset
|
84 -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ |
12726
d6da6e5f2f62
math: add portability warnings for classification macros
Eric Blake <ebb9@byu.net>
parents:
12422
diff
changeset
|
85 -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ |
9255
590a8ac4bca4
Rename math_.h to math.in.h.
Bruno Haible <bruno@clisp.org>
parents:
8995
diff
changeset
|
86 < $(srcdir)/math.in.h; \ |
11868
67c2b22aff08
annotate automake snippets with $(AM_V_GEN) and $(AM_V_at)
Jim Meyering <meyering@redhat.com>
parents:
11583
diff
changeset
|
87 } > $@-t && \ |
8186
c115624bf99a
New module 'math'. <math.h> replaces mathl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
88 mv $@-t $@ |
c115624bf99a
New module 'math'. <math.h> replaces mathl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
89 MOSTLYCLEANFILES += math.h math.h-t |
c115624bf99a
New module 'math'. <math.h> replaces mathl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
90 |
c115624bf99a
New module 'math'. <math.h> replaces mathl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
91 Include: |
c115624bf99a
New module 'math'. <math.h> replaces mathl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
92 <math.h> |
c115624bf99a
New module 'math'. <math.h> replaces mathl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
93 |
c115624bf99a
New module 'math'. <math.h> replaces mathl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
94 License: |
c115624bf99a
New module 'math'. <math.h> replaces mathl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
95 LGPL |
c115624bf99a
New module 'math'. <math.h> replaces mathl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
96 |
c115624bf99a
New module 'math'. <math.h> replaces mathl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
97 Maintainer: |
c115624bf99a
New module 'math'. <math.h> replaces mathl.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
98 all |