annotate tests/test-func.c @ 16616:2f2ef742aa4b

New module 'exp2'. * lib/math.in.h (exp2): New declaration. * lib/exp2.c: New file. * m4/exp2.m4: New file. * m4/math_h.m4 (gl_MATH_H): Test whether exp2 is declared. (gl_MATH_H_DEFAULTS): Initialize GNULIB_EXP2, HAVE_DECL_EXP2, REPLACE_EXP2. * modules/math (Makefile.am): Substitute GNULIB_EXP2, HAVE_DECL_EXP2, REPLACE_EXP2. * modules/exp2: New file. * tests/test-math-c++.cc: Check the declaration of exp2. * doc/posix-functions/exp2.texi: Mention the new module and the IRIX and OpenBSD problems.
author Bruno Haible <bruno@clisp.org>
date Wed, 07 Mar 2012 03:29:32 +0100
parents 8250f2777afc
children e542fd46ad6f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9761
f63d3075f044 Rename __func__ module to func.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
1 /* Test whether __func__ is available
16201
8250f2777afc maint: update all copyright year number ranges
Jim Meyering <meyering@redhat.com>
parents: 14079
diff changeset
2 Copyright (C) 2008-2012 Free Software Foundation, Inc.
9761
f63d3075f044 Rename __func__ module to func.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
3
f63d3075f044 Rename __func__ module to func.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
4 This program is free software: you can redistribute it and/or modify
f63d3075f044 Rename __func__ module to func.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
5 it under the terms of the GNU General Public License as published by
f63d3075f044 Rename __func__ module to func.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
6 the Free Software Foundation; either version 3 of the License, or
f63d3075f044 Rename __func__ module to func.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
7 (at your option) any later version.
f63d3075f044 Rename __func__ module to func.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
8
f63d3075f044 Rename __func__ module to func.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
9 This program is distributed in the hope that it will be useful,
f63d3075f044 Rename __func__ module to func.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
f63d3075f044 Rename __func__ module to func.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f63d3075f044 Rename __func__ module to func.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
12 GNU General Public License for more details.
f63d3075f044 Rename __func__ module to func.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
13
f63d3075f044 Rename __func__ module to func.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
14 You should have received a copy of the GNU General Public License
f63d3075f044 Rename __func__ module to func.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
f63d3075f044 Rename __func__ module to func.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
16
f63d3075f044 Rename __func__ module to func.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
17 /* Written by Bruno Haible <bruno@clisp.org>, 2008. */
f63d3075f044 Rename __func__ module to func.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
18
f63d3075f044 Rename __func__ module to func.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
19 #include <config.h>
f63d3075f044 Rename __func__ module to func.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
20
f63d3075f044 Rename __func__ module to func.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
21 #include <string.h>
f63d3075f044 Rename __func__ module to func.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
22
12496
a48d3d749ca5 Refactor common macros used in tests.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
23 #include "macros.h"
9761
f63d3075f044 Rename __func__ module to func.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
24
f63d3075f044 Rename __func__ module to func.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
25 int
f63d3075f044 Rename __func__ module to func.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
26 main ()
f63d3075f044 Rename __func__ module to func.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
27 {
11906
6b25bda86ddb Avoid sizeof __func__ == 0 pitfall.
Bruno Haible <bruno@clisp.org>
parents: 9889
diff changeset
28 ASSERT (strlen (__func__) > 0);
6b25bda86ddb Avoid sizeof __func__ == 0 pitfall.
Bruno Haible <bruno@clisp.org>
parents: 9889
diff changeset
29
6b25bda86ddb Avoid sizeof __func__ == 0 pitfall.
Bruno Haible <bruno@clisp.org>
parents: 9889
diff changeset
30 /* On SunPRO C 5.9, sizeof __func__ evaluates to 0. The compiler warns:
6b25bda86ddb Avoid sizeof __func__ == 0 pitfall.
Bruno Haible <bruno@clisp.org>
parents: 9889
diff changeset
31 "warning: null dimension: sizeof()". */
6b25bda86ddb Avoid sizeof __func__ == 0 pitfall.
Bruno Haible <bruno@clisp.org>
parents: 9889
diff changeset
32 #if !defined __SUNPRO_C
9761
f63d3075f044 Rename __func__ module to func.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
33 ASSERT (strlen (__func__) + 1 == sizeof __func__);
11906
6b25bda86ddb Avoid sizeof __func__ == 0 pitfall.
Bruno Haible <bruno@clisp.org>
parents: 9889
diff changeset
34 #endif
6b25bda86ddb Avoid sizeof __func__ == 0 pitfall.
Bruno Haible <bruno@clisp.org>
parents: 9889
diff changeset
35
12242
b966514efbf6 Fix typo in last commit.
Simon Josefsson <simon@josefsson.org>
parents: 12240
diff changeset
36 ASSERT (strcmp (__func__, "main") == 0
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 12242
diff changeset
37 || strcmp (__func__, "<unknown function>") == 0);
12240
04732481adba test-func.c: Also test value of __func__.
Simon Josefsson <simon@josefsson.org>
parents: 11906
diff changeset
38
9761
f63d3075f044 Rename __func__ module to func.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
39 return 0;
f63d3075f044 Rename __func__ module to func.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
40 }