gcc/fixincludes
Jakub Jelinek b04208895f c++: Implement P1467R9 - Extended floating-point types and standard names compiler part except for bfloat16 [PR106652]
The following patch implements the compiler part of C++23
P1467R9 - Extended floating-point types and standard names compiler part
by introducing _Float{16,32,64,128} as keywords and builtin types
like they are implemented for C already since GCC 7, with DF{16,32,64,128}_
mangling.
It also introduces _Float{32,64,128}x for C++ with the
https://github.com/itanium-cxx-abi/cxx-abi/pull/147
proposed mangling of DF{32,64,128}x.
The patch doesn't add anything for bfloat16_t support, as right now
__bf16 type refuses all conversions and arithmetic operations.
The patch wants to keep backwards compatibility with how __float128 has
been handled in C++ before, both for mangling and behavior in binary
operations, overload resolution etc.  So, there are some backend changes
where for C __float128 and _Float128 are the same type (float128_type_node
and float128t_type_node are the same pointer), but for C++ they are distinct
types which mangle differently and _Float128 is treated as extended
floating-point type while __float128 is treated as non-standard floating
point type.  The various C++23 changes about how floating-point types
are changed are actually implemented as written in the spec only if at least
one of the types involved is _Float{16,32,64,128,32x,64x,128x} (_FloatNx are
also treated as extended floating-point types) and kept previous behavior
otherwise.  For float/double/long double the rules are actually written that
they behave the same as before.
There is some backwards incompatibility at least on x86 regarding _Float16,
because that type was already used by that name and with the DF16_ mangling
(but only since GCC 12 and I think it isn't that widely used in the wild
yet).  E.g. config/i386/avx512fp16intrin.h shows the issues, where
in C or in GCC 12 in C++ one could pass 0.0f to a builtin taking _Float16
argument, but with the changes that is not possible anymore, one needs
to either use 0.0f16 or (_Float16) 0.0f.
We have also a problem with glibc headers, where since glibc 2.27
math.h and complex.h aren't compilable with these changes.  One gets
errors like:
In file included from /usr/include/math.h:43,
                 from abc.c:1:
/usr/include/bits/floatn.h:86:9: error: multiple types in one declaration
   86 | typedef __float128 _Float128;
      |         ^~~~~~~~~~
/usr/include/bits/floatn.h:86:20: error: declaration does not declare anything [-fpermissive]
   86 | typedef __float128 _Float128;
      |                    ^~~~~~~~~
In file included from /usr/include/bits/floatn.h:119:
/usr/include/bits/floatn-common.h:214:9: error: multiple types in one declaration
  214 | typedef float _Float32;
      |         ^~~~~
/usr/include/bits/floatn-common.h:214:15: error: declaration does not declare anything [-fpermissive]
  214 | typedef float _Float32;
      |               ^~~~~~~~
/usr/include/bits/floatn-common.h:251:9: error: multiple types in one declaration
  251 | typedef double _Float64;
      |         ^~~~~~
/usr/include/bits/floatn-common.h:251:16: error: declaration does not declare anything [-fpermissive]
  251 | typedef double _Float64;
      |                ^~~~~~~~
This is from snippets like:
 /* The remaining of this file provides support for older compilers.  */
 # if __HAVE_FLOAT128

 /* The type _Float128 exists only since GCC 7.0.  */
 #  if !__GNUC_PREREQ (7, 0) || defined __cplusplus
 typedef __float128 _Float128;
 #  endif
where it hardcodes that C++ doesn't have _Float{16,32,64,128,32x,64x,128x} support nor
{f,F}{16,32,64,128}{,x} literal suffixes nor _Complex _Float{16,32,64,128,32x,64x,128x}.
The patch fixincludes this for now and hopefully if this is committed, then
glibc can change those.  The patch changes those
 #  if !__GNUC_PREREQ (7, 0) || defined __cplusplus
conditions to
 #  if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
Another thing is mangling, as said above, Itanium C++ ABI specifies
DF <number> _ as _Float{16,32,64,128} mangling, but GCC was implementing
a mangling incompatible with that starting with DF for fixed point types.
Fixed point was never supported in C++ though, I believe the reason why
the mangling has been added was that due to a bug it would leak into the
C++ FE through decltype (0.0r) etc.  But that has been shortly after the
mangling was added fixed (I think in the same GCC release cycle), so we
now reject 0.0r etc. in C++.  If we ever need the fixed point mangling,
I think it can be readded but better with a different prefix so that it
doesn't conflict with the published standard manglings.  So, this patch
also kills the fixed point mangling and implements the DF <number> _
demangling.
The patch predefines __STDCPP_FLOAT{16,32,64,128}_T__ macros when
those types are available, but only for C++23, while the underlying types
are available in C++98 and later including the {f,F}{16,32,64,128} literal
suffixes (but those with a pedwarn for C++20 and earlier).  My understanding
is that it needs to be predefined by the compiler, on the other side
predefining even for older modes when <stdfloat> is a new C++23 header
would be weird.  One can find out if _Float{16,32,64,128,32x,64x,128x} is
supported in C++ by
__GNUC__ >= 13 && defined(__FLT{16,32,64,128,32X,64X,128X}_MANT_DIG__)
(but that doesn't work well with older G++ 13 snapshots).

As for std::bfloat16_t, three targets (aarch64, arm and x86) apparently
"support" __bf16 type which has the bfloat16 format, but isn't really
usable, e.g. {aarch64,arm,ix86}_invalid_conversion disallow any conversions
from or to type with BFmode, {aarch64,arm,ix86}_invalid_unary_op disallows
any unary operations on those except for ADDR_EXPR and
{aarch64,arm,ix86}_invalid_binary_op disallows any binary operation on
those.  So, I think we satisfy:
"If the implementation supports an extended floating-point type with the
properties, as specified by ISO/IEC/IEEE 60559, of radix (b) of 2, storage
width in bits (k) of 16, precision in bits (p) of 8, maximum exponent (emax)
of 127, and exponent field width in bits (w) of 8, then the typedef-name
std::bfloat16_t is defined in the header <stdfloat> and names such a type,
the macro __STDCPP_BFLOAT16_T__ is defined, and the floating-point literal
suffixes bf16 and BF16 are supported."
because we don't really support those right now.

2022-09-27  Jakub Jelinek  <jakub@redhat.com>

	PR c++/106652
	PR c++/85518
gcc/
	* tree-core.h (enum tree_index): Add TI_FLOAT128T_TYPE
	enumerator.
	* tree.h (float128t_type_node): Define.
	* tree.cc (build_common_tree_nodes): Initialize float128t_type_node.
	* builtins.def (DEF_FLOATN_BUILTIN): Adjust comment now that
	_Float<N> is supported in C++ too.
	* config/i386/i386.cc (ix86_mangle_type): Only mangle as "g"
	float128t_type_node.
	* config/i386/i386-builtins.cc (ix86_init_builtin_types): Use
	float128t_type_node for __float128 instead of float128_type_node
	and create it if NULL.
	* config/i386/avx512fp16intrin.h (_mm_setzero_ph, _mm256_setzero_ph,
	_mm512_setzero_ph, _mm_set_sh, _mm_load_sh): Use 0.0f16 instead of
	0.0f.
	* config/ia64/ia64.cc (ia64_init_builtins): Use
	float128t_type_node for __float128 instead of float128_type_node
	and create it if NULL.
	* config/rs6000/rs6000-c.cc (is_float128_p): Also return true
	for float128t_type_node if non-NULL.
	* config/rs6000/rs6000.cc (rs6000_mangle_type): Don't mangle
	float128_type_node as "u9__ieee128".
	* config/rs6000/rs6000-builtin.cc (rs6000_init_builtins): Use
	float128t_type_node for __float128 instead of float128_type_node
	and create it if NULL.
gcc/c-family/
	* c-common.cc (c_common_reswords): Change _Float{16,32,64,128} and
	_Float{32,64,128}x flags from D_CONLY to 0.
	(shorten_binary_op): Punt if common_type returns error_mark_node.
	(shorten_compare): Likewise.
	(c_common_nodes_and_builtins): For C++ record _Float{16,32,64,128}
	and _Float{32,64,128}x builtin types if available.  For C++
	clear float128t_type_node.
	* c-cppbuiltin.cc (c_cpp_builtins): Predefine
	__STDCPP_FLOAT{16,32,64,128}_T__ for C++23 if supported.
	* c-lex.cc (interpret_float): For q/Q suffixes prefer
	float128t_type_node over float128_type_node.  Allow
	{f,F}{16,32,64,128} suffixes for C++ if supported with pedwarn
	for C++20 and older.  Allow {f,F}{32,64,128}x suffixes for C++
	with pedwarn.  Don't call excess_precision_type for C++.
gcc/cp/
	* cp-tree.h (cp_compare_floating_point_conversion_ranks): Implement
	P1467R9 - Extended floating-point types and standard names except
	for std::bfloat16_t for now.  Declare.
	(extended_float_type_p): New inline function.
	* mangle.cc (write_builtin_type): Mangle float{16,32,64,128}_type_node
	as DF{16,32,64,128}_.  Mangle float{32,64,128}x_type_node as
	DF{32,64,128}x.  Remove FIXED_POINT_TYPE mangling that conflicts
	with that.
	* typeck2.cc (check_narrowing): If one of ftype or type is extended
	floating-point type, compare floating-point conversion ranks.
	* parser.cc (cp_keyword_starts_decl_specifier_p): Handle
	CASE_RID_FLOATN_NX.
	(cp_parser_simple_type_specifier): Likewise and diagnose missing
	_Float<N> or _Float<N>x support if not supported by target.
	* typeck.cc (cp_compare_floating_point_conversion_ranks): New function.
	(cp_common_type): If both types are REAL_TYPE and one or both are
	extended floating-point types, select common type based on comparison
	of floating-point conversion ranks and subranks.
	(cp_build_binary_op): Diagnose operation with floating point arguments
	with unordered conversion ranks.
	* call.cc (standard_conversion): For floating-point conversion, if
	either from or to are extended floating-point types, set conv->bad_p
	for implicit conversion from larger to smaller conversion rank or
	with unordered conversion ranks.
	(convert_like_internal): Emit a pedwarn on such conversions.
	(build_conditional_expr): Diagnose operation with floating point
	arguments with unordered conversion ranks.
	(convert_arg_to_ellipsis): Don't promote extended floating-point types
	narrower than double to double.
	(compare_ics): Implement P1467R9 [over.ics.rank]/4 changes.
gcc/testsuite/
	* g++.dg/cpp23/ext-floating1.C: New test.
	* g++.dg/cpp23/ext-floating2.C: New test.
	* g++.dg/cpp23/ext-floating3.C: New test.
	* g++.dg/cpp23/ext-floating4.C: New test.
	* g++.dg/cpp23/ext-floating5.C: New test.
	* g++.dg/cpp23/ext-floating6.C: New test.
	* g++.dg/cpp23/ext-floating7.C: New test.
	* g++.dg/cpp23/ext-floating8.C: New test.
	* g++.dg/cpp23/ext-floating9.C: New test.
	* g++.dg/cpp23/ext-floating10.C: New test.
	* g++.dg/cpp23/ext-floating.h: New file.
	* g++.target/i386/float16-1.C: Adjust expected diagnostics.
libcpp/
	* expr.cc (interpret_float_suffix): Allow {f,F}{16,32,64,128} and
	{f,F}{32,64,128}x suffixes for C++.
include/
	* demangle.h (enum demangle_component_type): Add
	DEMANGLE_COMPONENT_EXTENDED_BUILTIN_TYPE.
	(struct demangle_component): Add u.s_extended_builtin member.
libiberty/
	* cp-demangle.c (d_dump): Handle
	DEMANGLE_COMPONENT_EXTENDED_BUILTIN_TYPE.  Don't handle
	DEMANGLE_COMPONENT_FIXED_TYPE.
	(d_make_extended_builtin_type): New function.
	(cplus_demangle_builtin_types): Add _Float entry.
	(cplus_demangle_type): For DF demangle it as _Float<N> or
	_Float<N>x rather than fixed point which conflicts with it.
	(d_count_templates_scopes): Handle
	DEMANGLE_COMPONENT_EXTENDED_BUILTIN_TYPE.  Just break; for
	DEMANGLE_COMPONENT_FIXED_TYPE.
	(d_find_pack): Handle DEMANGLE_COMPONENT_EXTENDED_BUILTIN_TYPE.
	Don't handle DEMANGLE_COMPONENT_FIXED_TYPE.
	(d_print_comp_inner): Likewise.
	* cp-demangle.h (D_BUILTIN_TYPE_COUNT): Bump.
	* testsuite/demangle-expected: Replace _Z3xxxDFyuVb test
	with _Z3xxxDF16_DF32_DF64_DF128_CDF16_Vb.  Add
	_Z3xxxDF32xDF64xDF128xCDF32xVb test.
fixincludes/
	* inclhack.def (glibc_cxx_floatn_1, glibc_cxx_floatn_2,
	glibc_cxx_floatn_3): New fixes.
	* tests/base/bits/floatn.h: New file.
	* fixincl.x: Regenerated.
2022-09-27 08:18:00 +02:00
..
tests/base c++: Implement P1467R9 - Extended floating-point types and standard names compiler part except for bfloat16 [PR106652] 2022-09-27 08:18:00 +02:00
aclocal.m4 Update GCC to autoconf 2.69, automake 1.15.1 (PR bootstrap/82856). 2018-10-31 17:03:16 +00:00
ChangeLog Daily bump. 2022-09-01 00:17:39 +00:00
check.tpl
config.h.in regenerate configure files and config.h.in files 2022-08-25 14:23:40 +02:00
configure hpux removal: regenerate configure files 2022-08-31 22:23:50 +02:00
configure.ac Update GCC to autoconf 2.69, automake 1.15.1 (PR bootstrap/82856). 2018-10-31 17:03:16 +00:00
fixfixes.c fixinc: don't "fix" machine names in __has_include(...) [PR91085] 2021-06-30 10:43:20 +08:00
fixinc.in fixincludes: Update pwd. 2022-02-04 13:53:23 +01:00
fixincl.c fixincludes: don't abort() on access failure [PR103306] 2021-11-24 03:18:38 +08:00
fixincl.tpl
fixincl.x c++: Implement P1467R9 - Extended floating-point types and standard names compiler part except for bfloat16 [PR106652] 2022-09-27 08:18:00 +02:00
fixlib.c
fixlib.h
fixopts.c
fixtests.c
genfixes
inclhack.def c++: Implement P1467R9 - Extended floating-point types and standard names compiler part except for bfloat16 [PR106652] 2022-09-27 08:18:00 +02:00
Makefile.in
mkfixinc.sh skip fixinc on vxworks7*, amend mkheaders 2020-02-13 15:52:18 -03:00
mkheaders.in Allow CONFIG_SHELL to override build-time shell in mkheaders 2020-02-20 22:09:03 -03:00
procopen.c
README
README-fixinc
server.c
server.h
system.h

GCC MAINTAINER INFORMATION
==========================

If you are having some problem with a system header that is either
broken by the manufacturer, or is broken by the fixinclude process,
then you will need to alter or add information to the include fix
definitions file, ``inclhack.def''.  Please also send relevant
information to gcc-bugs@gcc.gnu.org, gcc-patches@gcc.gnu.org and,
please, to me:  bkorb@gnu.org.

To make your fix, you will need to do several things:

1.  Obtain access to the AutoGen program on some platform.  It does
    not have to be your build platform, but it is more convenient.

2.  Edit "inclhack.def" to reflect the changes you need to make.
    See below for information on how to make those changes.

3.  Run the "genfixes" shell script to produce a new copy of
    the "fixincl.x" file.

4.  Rebuild the compiler and check the header causing the issue.
    Make sure it is now properly handled.  Add tests to the
    "test_text" entry(ies) that validate your fix.  This will
    help ensure that future fixes won't negate your work.
    Do *NOT* specify test text for "wrap" or "replacement" fixes.
    There is no real possibility that these fixes will fail.
    If they do, you will surely know straight away.

    NOTE:  "test_text" is interpreted by the shell as it gets
    copied into the test header.  THEREFORE you must quote
    dollar sign characters and back quotes -- unless you mean
    for them to be interpreted by the shell.

    e.g. the math_huge_val_from_dbl_max test_text needs to
    put text into both float.h and math.h, so it includes a
    back-quoted script to add text to float.h.

5.  Go into the fixincludes build directory and type, "make check".
    You are guaranteed to have issues printed out as a result.
    Look at the diffs produced.  Make sure you have not clobbered
    the proper functioning of a different fix.  Make sure your
    fix is properly tested and it does what it is supposed to do.

6.  Now that you have the right things happening, synchronize the
    $(srcdir)/tests/base directory with the $(builddir)/tests/res
    directory.  The output of "make check" will be some diffs that
    should give you some hints about what to do.

7.  Rerun "make check" and verify that there are no issues left.


MAKING CHANGES TO INCLHACK.DEF
==============================

0.  If you are not the fixincludes maintainer, please send that
    person email about any changes you may want to make.  Thanks!

1.  Every fix must have a "hackname" that is compatible with C syntax
    for variable names and is unique without regard to alphabetic case.
    Please keep them alphabetical by this name.  :-)

2.  If the problem is known to exist only in certain files, then
    identify the files with "files = " entries.  If you use fnmatch(3C)
    wild card characters in a "files" entry, be certain that the first
    "files" entry has no such character.  Otherwise, the "make check"
    machinery will attempt to create files with those characters in the
    name.  That is inconvenient.

3.  It is relatively expensive to fire off a process to fix a source
    file, therefore write apply tests to avoid unnecessary fix
    processes.  The preferred apply tests are "select", "bypass", "mach"
    "sum", and "c-test" because they are performed internally:

    * select - Run a regex on the contents of the file being considered.
               All such regex-es must match.  Matching is done with
               extended regular expressions.

    * bypass - Run a regex on the contents of the file being considered.
               No such regex may match.

    * sum    - Select a specific version of a file that has a matching
               check sum.  The BSD version of checksum ["sum(1BSD)"]
               is used.  Each "sum" entry should contain exactly three
               space separated tokens:  the sum, some number and the
               basename of the file.  The "some number" is ignored.
               If there are multiple "sum" entries, only one needs to
               match in order to pass.  For example:

                   sum = '1234 3 foobar.h';

               specifies that the "foobar.h" header in any directory
               will match if it has the checksum 1234.

    * c_test - call a function in fixtests.c.  See that file.

    * files  - the "fnmatch" pattern of the file(s) to examine for
               the issue.  There may be several copies of this attribute.
               If the header lives in a /usr/include subdirectory, be
               sure to include that subdirectory in the name. e.g. net/if.h

    * mach   - Match the output of config.guess against a series of fnmatch
               patterns.  It must match at least one of the patterns, unless
               "not-machine" has also been specified.  In that case, the
               config.guess output must not match any of the patterns.

    The next test is relatively slow because it must be handled in a
    separate shell process.  Some platforms do not support server shells,
    so the whole process is even slower and more cumbersome there.

    * test   - These should be arguments to the program, "/bin/test".
               You may perform multiple commands, if you enclose them
               in backquotes and echo out valid test arguments.  For
               example, you might echo out '0 -eq 1' if you want a false
               result, or '0 -eq 0' for a true result.

    These tests are required to:

    1.  Be positive for all header files that require the fix.

    It is desirable to:

    2.  Be negative as often as possible whenever the fix is not
        required, avoiding the process overhead.

    It is nice if:

    3.  The expression is as simple as possible to both
        process and understand by people.  :-)

        Please take advantage of the fact AutoGen will glue
        together string fragments.  It helps.  Also take note
        that double quote strings and single quote strings have
        different formation rules.  Double quote strings are a
        tiny superset of ANSI-C string syntax.  Single quote
        strings follow shell single quote string formation
        rules, except that the backslash is processed before
        '\\', '\'' and '#' characters (using C character syntax).

    Each test must pass or the fix is not applied.  For example,
    all "select" expressions must be found and not one "bypass"
    selection may be found.

    Examples of test specifications:

      hackname = broken_assert_stdio;
      files    = assert.h;
      select   = stderr;
      bypass   = "include.*stdio.h";

    The ``broken_assert_stdio'' fix will be applied only to a file
    named "assert.h" if it contains the string "stderr" _and_ it
    does _not_ contain the expression "include.*stdio.h".

      hackname = no_double_slash;
      c_test   = "double_slash";

    The ``no_double_slash'' fix will be applied if the
    ``double_slash_test()'' function says to.  See ``fixtests.c''
    for documentation on how to include new functions into that
    module.

4.  There are currently four methods of fixing a file:

    1.  a series of sed expressions.  Each will be an individual
        "-e" argument to a single invocation of sed.  Unless you
        need to use multiple or complex sed expressions, please
        use the "replacement text" method instead.

    2.  a shell script.  These scripts are _required_ to read all
        of stdin in order to avoid pipe stalls.  They may choose to
        discard the input.

    3.  Replacement text.  If the replacement is empty, then no
        fix is applied.  Otherwise, the replacement text is
        written to the output file and no further fixes are
        applied.  If you really want a no-op file, replace the
        file with a comment.

        Replacement text "fixes" must be first in this file!!

    4.  A C language subroutine method for both tests and fixes.
        See ``fixtests.c'' for instructions on writing C-language
        applicability tests and ``fixfixes.c'' for C-language fixing.
        These files also contain tables that describe the currently
        implemented fixes and tests.

    If at all possible, you should try to use one of the C language
    fixes as it is far more efficient.  There are currently five
    such fixes, three of which are very special purpose:

    i) char_macro_def - This function repairs the definition of an
        ioctl macro that presumes CPP macro substitution within
        pairs of single quote characters.

    ii) char_macro_use - This function repairs the usage of ioctl
        macros that no longer can wrap an argument with single quotes.

    iii) machine_name - This function will look at "#if", "#ifdef",
        "#ifndef" and "#elif" directive lines and replace the first
        occurrence of a non-reserved name that is traditionally
        pre-defined by the native compiler.

    The next two are for general use:

    iv) wrap - wraps the entire file with "#ifndef", "#define" and
        "#endif" self-exclusionary text.  It also, optionally, inserts
        a prolog after the "#define" and an epilog just before the
        "#endif".  You can use this for a fix as follows:

            c_fix     = wrap;
            c_fix_arg = "/* prolog text */";
            c_fix_arg = "/* epilog text */";

        If you want an epilog without a prolog, set the first "c_fix_arg"
        to the empty string.  Both or the second "c_fix_arg"s may be
        omitted and the file will still be wrapped.

	THERE IS A SPECIAL EXCEPTION TO THIS, HOWEVER:

	If the regular expression '#if.*__need' is found, then it is
	assumed that the file needs to be read and interpreted more
	than once.  However, the prolog and epilog text (if any) will
	be inserted.

    v) format - Replaces text selected with a regular expression with
        a specialized formating string.  The formatting works as follows:
        The format text is copied to the output until a '%' character
        is found.  If the character after the '%' is another '%', then
        one '%' is output and processing continues.  If the following
        character is not a digit, then the '%' and that character are
        copied and processing continues.  Finally, if the '%' *is*
        followed by a digit, that digit is used as an index into the
        regmatch_t array to replace the two characters with the matched
        text.  i.e.: "%0" is replaced by the full matching text, "%1"
        is the first matching sub-expression, etc.

        This is used as follows:

            c_fix     = format;
            c_fix_arg = "#ifndef %1\n%0\n#endif";
            c_fix_arg = "#define[ \t]+([A-Z][A-Z0-9a-z_]*).*";

        This would wrap a one line #define inside of a "#ifndef"/"#endif"
        pair.  The second "c_fix_arg" may be omitted *IF* there is at least
        one select clause and the first one identifies the text you wish to
        reformat.  It will then be used as the second "c_fix_arg".  You may
        delete the selected text by supplying an empty string for the
        replacement format (the first "c_fix_arg").

	Note: In general, a format c_fix may be used in place of one
	sed expression.  However, it will need to be rewritten by
	hand.  For example:

	sed = 's@^#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7$'
	       '@& || __GNUC__ >= 3@';

	may be rewritten using a format c_fix as:

	c_fix     = format;
	c_fix_arg = '%0 || __GNUC__ >= 3';
	c_fix_arg = '^#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7$';

	Multiple sed substitution expressions probably ought to remain sed
	expressions in order to maintain clarity.  Also note that if the
	second sed expression is the same as the first select expression,
	then you may omit the second c_fix_arg.  The select expression will
	be picked up and used in its absence.

EXAMPLES OF FIXES:
==================

      hackname = AAA_ki_iface;
      replace; /* empty replacement -> no fixing the file */

    When this ``fix'' is invoked, it will prevent any fixes
    from being applied.

    ------------------

      hackname = AAB_svr4_no_varargs;
      replace  = "/* This file was generated by fixincludes.  */\n"
                 "#ifndef _SYS_VARARGS_H\n"
                 "#define _SYS_VARARGS_H\n\n"

                 "#ifdef __STDC__\n"
                 "#include <stdarg.h>\n"
                 "#else\n"
                 "#include <varargs.h>\n"
                 "#endif\n\n"

                 "#endif  /* _SYS_VARARGS_H */\n";

    When this ``fix'' is invoked, the replacement text will be
    emitted into the replacement include file.  No further fixes
    will be applied.

    ------------------

        hackname  = hpux11_fabsf;
        files     = math.h;
        select    = "^[ \t]*#[ \t]*define[ \t]+fabsf\\(.*";
        bypass    = "__cplusplus";

        c_fix     = format;
        c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";

        test_text =
        "#  define fabsf(x) ((float)fabs((double)(float)(x)))\n";

    This fix will ensure that the #define for fabs is wrapped
    with C++ protection, providing the header is not already
    C++ aware.

    ------------------

5.  Testing fixes.

    The brute force method is, of course, to configure and build
    GCC.  But you can also:

        cd ${top_builddir}/gcc
        rm -rf include-fixed/ stmp-fixinc
        make stmp-fixinc

    I would really recommend, however:

        cd ${top_builddir}/fixincludes
        make check

    To do this, you *must* have autogen installed on your system.
    The "check" step will proceed to construct a shell script that
    will exercise all the fixes, using the sample test_text
    provided with each fix.  Once done, the changes made will
    be compared against the changes saved in the source directory.
    If you are changing the tests or fixes, the change will likely
    be highlighted.