Mark C2x built-in functions as such.
Various built-in functions that GCC has as extensions are now standard functions in C2x. This patch adds DEF_C2X_BUILTIN and uses it to mark them as such. Some of the so-marked functions were previously DEF_EXT_LIB_BUILTIN, while some DFP ones were DEF_GCC_BUILTIN (i.e. __builtin_* only); both sets become DEF_C2X_BUILTIN. This in turn requires flag_isoc2x to be defined in various front ends using builtins.def. As the semantics of the built-in functions should already be tested, the tests added only verify that they are declared in C2x mode but not in C11 mode. The test of DFP built-in functions being declared for C2x goes in gcc.dg/dfp/, as while such built-in functions currently don't depend on whether DFP is supported, that looks like a bug to me (see bug 91985), so it seems best for the tests not to depend on exactly how that bug might be fixed. Bootstrapped with no regressions on x86_64-pc-linux-gnu. gcc: * builtins.def (DEF_C2X_BUILTIN): New macro. (exp10, exp10f, exp10l, fabsd32, fabsd64, fabsd128, nand32) (nand64, nand128, roundeven, roundevenf, roundevenl, strdup) (strndup): Use DEF_C2X_BUILTIN. * coretypes.h (enum function_class): Add function_c2x_misc. gcc/ada: * gcc-interface/utils.c (flag_isoc2x): New variable. gcc/brig: * brig-lang.c (flag_isoc2x): New variable. gcc/lto: * lto-lang.c (flag_isoc2x): New variable. gcc/testsuite: * gcc.dg/c11-builtins-1.c, gcc.dg/c2x-builtins-1.c, gcc.dg/dfp/c2x-builtins-dfp-1.c: New tests. From-SVN: r276588
This commit is contained in:
parent
0046f8d750
commit
0fa0048302
13 changed files with 94 additions and 15 deletions
|
@ -1,3 +1,11 @@
|
|||
2019-10-04 Joseph Myers <joseph@codesourcery.com>
|
||||
|
||||
* builtins.def (DEF_C2X_BUILTIN): New macro.
|
||||
(exp10, exp10f, exp10l, fabsd32, fabsd64, fabsd128, nand32)
|
||||
(nand64, nand128, roundeven, roundevenf, roundevenl, strdup)
|
||||
(strndup): Use DEF_C2X_BUILTIN.
|
||||
* coretypes.h (enum function_class): Add function_c2x_misc.
|
||||
|
||||
2019-10-04 Maya Rashish <coypu@sdf.org>
|
||||
|
||||
* ira-color.c (update_costs_from_allocno): Call
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2019-10-04 Joseph Myers <joseph@codesourcery.com>
|
||||
|
||||
* gcc-interface/utils.c (flag_isoc2x): New variable.
|
||||
|
||||
2019-10-01 Maciej W. Rozycki <macro@wdc.com>
|
||||
|
||||
* gcc-interface/Makefile.in (ADA_RTL_DSO_DIR): New variable.
|
||||
|
|
|
@ -6901,6 +6901,7 @@ def_builtin_1 (enum built_in_function fncode,
|
|||
static int flag_isoc94 = 0;
|
||||
static int flag_isoc99 = 0;
|
||||
static int flag_isoc11 = 0;
|
||||
static int flag_isoc2x = 0;
|
||||
|
||||
/* Install what the common builtins.def offers plus our local additions.
|
||||
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2019-10-04 Joseph Myers <joseph@codesourcery.com>
|
||||
|
||||
* brig-lang.c (flag_isoc2x): New variable.
|
||||
|
||||
2019-08-23 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR middle-end/91283
|
||||
|
|
|
@ -587,6 +587,7 @@ static GTY(()) tree signed_size_type_node;
|
|||
int flag_isoc94;
|
||||
int flag_isoc99;
|
||||
int flag_isoc11;
|
||||
int flag_isoc2x;
|
||||
|
||||
static void
|
||||
def_fn_type (builtin_type def, builtin_type ret, bool var, int n, ...)
|
||||
|
|
|
@ -154,6 +154,13 @@ along with GCC; see the file COPYING3. If not see
|
|||
DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE, \
|
||||
true, true, !flag_isoc11, ATTRS, targetm.libc_has_function (function_c11_misc), true)
|
||||
|
||||
/* Like DEF_LIB_BUILTIN, except that the function is only a part of
|
||||
the standard in C2x or above. */
|
||||
#undef DEF_C2X_BUILTIN
|
||||
#define DEF_C2X_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
|
||||
DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE, \
|
||||
true, true, !flag_isoc2x, ATTRS, targetm.libc_has_function (function_c2x_misc), true)
|
||||
|
||||
/* Like DEF_C99_BUILTIN, but for complex math functions. */
|
||||
#undef DEF_C99_COMPL_BUILTIN
|
||||
#define DEF_C99_COMPL_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
|
||||
|
@ -335,9 +342,9 @@ DEF_C99_BUILTIN (BUILT_IN_ERFCL, "erfcl", BT_FN_LONGDOUBLE_LONGDOUBLE, AT
|
|||
DEF_C99_BUILTIN (BUILT_IN_ERFF, "erff", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING)
|
||||
DEF_C99_BUILTIN (BUILT_IN_ERFL, "erfl", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
|
||||
DEF_LIB_BUILTIN (BUILT_IN_EXP, "exp", BT_FN_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
|
||||
DEF_EXT_LIB_BUILTIN (BUILT_IN_EXP10, "exp10", BT_FN_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
|
||||
DEF_EXT_LIB_BUILTIN (BUILT_IN_EXP10F, "exp10f", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO)
|
||||
DEF_EXT_LIB_BUILTIN (BUILT_IN_EXP10L, "exp10l", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
|
||||
DEF_C2X_BUILTIN (BUILT_IN_EXP10, "exp10", BT_FN_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
|
||||
DEF_C2X_BUILTIN (BUILT_IN_EXP10F, "exp10f", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO)
|
||||
DEF_C2X_BUILTIN (BUILT_IN_EXP10L, "exp10l", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
|
||||
DEF_C99_BUILTIN (BUILT_IN_EXP2, "exp2", BT_FN_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
|
||||
DEF_C99_BUILTIN (BUILT_IN_EXP2F, "exp2f", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO)
|
||||
DEF_C99_BUILTIN (BUILT_IN_EXP2L, "exp2l", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
|
||||
|
@ -352,9 +359,9 @@ DEF_C99_C90RES_BUILTIN (BUILT_IN_FABSL, "fabsl", BT_FN_LONGDOUBLE_LONGDOUBLE, AT
|
|||
#define FABS_TYPE(F) BT_FN_##F##_##F
|
||||
DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_FABS, "fabs", FABS_TYPE, ATTR_CONST_NOTHROW_LEAF_LIST)
|
||||
#undef FABS_TYPE
|
||||
DEF_GCC_BUILTIN (BUILT_IN_FABSD32, "fabsd32", BT_FN_DFLOAT32_DFLOAT32, ATTR_CONST_NOTHROW_LEAF_LIST)
|
||||
DEF_GCC_BUILTIN (BUILT_IN_FABSD64, "fabsd64", BT_FN_DFLOAT64_DFLOAT64, ATTR_CONST_NOTHROW_LEAF_LIST)
|
||||
DEF_GCC_BUILTIN (BUILT_IN_FABSD128, "fabsd128", BT_FN_DFLOAT128_DFLOAT128, ATTR_CONST_NOTHROW_LEAF_LIST)
|
||||
DEF_C2X_BUILTIN (BUILT_IN_FABSD32, "fabsd32", BT_FN_DFLOAT32_DFLOAT32, ATTR_CONST_NOTHROW_LEAF_LIST)
|
||||
DEF_C2X_BUILTIN (BUILT_IN_FABSD64, "fabsd64", BT_FN_DFLOAT64_DFLOAT64, ATTR_CONST_NOTHROW_LEAF_LIST)
|
||||
DEF_C2X_BUILTIN (BUILT_IN_FABSD128, "fabsd128", BT_FN_DFLOAT128_DFLOAT128, ATTR_CONST_NOTHROW_LEAF_LIST)
|
||||
DEF_C99_BUILTIN (BUILT_IN_FDIM, "fdim", BT_FN_DOUBLE_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
|
||||
DEF_C99_BUILTIN (BUILT_IN_FDIMF, "fdimf", BT_FN_FLOAT_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO)
|
||||
DEF_C99_BUILTIN (BUILT_IN_FDIML, "fdiml", BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
|
||||
|
@ -501,9 +508,9 @@ DEF_C99_BUILTIN (BUILT_IN_NANF, "nanf", BT_FN_FLOAT_CONST_STRING, ATTR_CO
|
|||
DEF_C99_BUILTIN (BUILT_IN_NANL, "nanl", BT_FN_LONGDOUBLE_CONST_STRING, ATTR_CONST_NOTHROW_NONNULL)
|
||||
#define NAN_TYPE(F) BT_FN_##F##_CONST_STRING
|
||||
DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_NAN, "nan", NAN_TYPE, ATTR_CONST_NOTHROW_NONNULL)
|
||||
DEF_GCC_BUILTIN (BUILT_IN_NAND32, "nand32", BT_FN_DFLOAT32_CONST_STRING, ATTR_CONST_NOTHROW_NONNULL)
|
||||
DEF_GCC_BUILTIN (BUILT_IN_NAND64, "nand64", BT_FN_DFLOAT64_CONST_STRING, ATTR_CONST_NOTHROW_NONNULL)
|
||||
DEF_GCC_BUILTIN (BUILT_IN_NAND128, "nand128", BT_FN_DFLOAT128_CONST_STRING, ATTR_CONST_NOTHROW_NONNULL)
|
||||
DEF_C2X_BUILTIN (BUILT_IN_NAND32, "nand32", BT_FN_DFLOAT32_CONST_STRING, ATTR_CONST_NOTHROW_NONNULL)
|
||||
DEF_C2X_BUILTIN (BUILT_IN_NAND64, "nand64", BT_FN_DFLOAT64_CONST_STRING, ATTR_CONST_NOTHROW_NONNULL)
|
||||
DEF_C2X_BUILTIN (BUILT_IN_NAND128, "nand128", BT_FN_DFLOAT128_CONST_STRING, ATTR_CONST_NOTHROW_NONNULL)
|
||||
DEF_GCC_BUILTIN (BUILT_IN_NANS, "nans", BT_FN_DOUBLE_CONST_STRING, ATTR_CONST_NOTHROW_NONNULL)
|
||||
DEF_GCC_BUILTIN (BUILT_IN_NANSF, "nansf", BT_FN_FLOAT_CONST_STRING, ATTR_CONST_NOTHROW_NONNULL)
|
||||
DEF_GCC_BUILTIN (BUILT_IN_NANSL, "nansl", BT_FN_LONGDOUBLE_CONST_STRING, ATTR_CONST_NOTHROW_NONNULL)
|
||||
|
@ -542,9 +549,9 @@ DEF_C99_BUILTIN (BUILT_IN_RINTL, "rintl", BT_FN_LONGDOUBLE_LONGDOUBLE, AT
|
|||
#define RINT_TYPE(F) BT_FN_##F##_##F
|
||||
DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_RINT, "rint", RINT_TYPE, ATTR_CONST_NOTHROW_LEAF_LIST)
|
||||
#undef RINT_TYPE
|
||||
DEF_EXT_LIB_BUILTIN (BUILT_IN_ROUNDEVEN, "roundeven", BT_FN_DOUBLE_DOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
|
||||
DEF_EXT_LIB_BUILTIN (BUILT_IN_ROUNDEVENF, "roundevenf", BT_FN_FLOAT_FLOAT, ATTR_CONST_NOTHROW_LEAF_LIST)
|
||||
DEF_EXT_LIB_BUILTIN (BUILT_IN_ROUNDEVENL, "roundevenl", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
|
||||
DEF_C2X_BUILTIN (BUILT_IN_ROUNDEVEN, "roundeven", BT_FN_DOUBLE_DOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
|
||||
DEF_C2X_BUILTIN (BUILT_IN_ROUNDEVENF, "roundevenf", BT_FN_FLOAT_FLOAT, ATTR_CONST_NOTHROW_LEAF_LIST)
|
||||
DEF_C2X_BUILTIN (BUILT_IN_ROUNDEVENL, "roundevenl", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
|
||||
DEF_C99_BUILTIN (BUILT_IN_ROUND, "round", BT_FN_DOUBLE_DOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
|
||||
DEF_C99_BUILTIN (BUILT_IN_ROUNDF, "roundf", BT_FN_FLOAT_FLOAT, ATTR_CONST_NOTHROW_LEAF_LIST)
|
||||
DEF_C99_BUILTIN (BUILT_IN_ROUNDL, "roundl", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
|
||||
|
@ -706,8 +713,8 @@ DEF_LIB_BUILTIN (BUILT_IN_STRCHR, "strchr", BT_FN_STRING_CONST_STRING_INT
|
|||
DEF_LIB_BUILTIN (BUILT_IN_STRCMP, "strcmp", BT_FN_INT_CONST_STRING_CONST_STRING, ATTR_PURE_NOTHROW_NONNULL_LEAF)
|
||||
DEF_LIB_BUILTIN (BUILT_IN_STRCPY, "strcpy", BT_FN_STRING_STRING_CONST_STRING, ATTR_RET1_NOTHROW_NONNULL_LEAF)
|
||||
DEF_LIB_BUILTIN (BUILT_IN_STRCSPN, "strcspn", BT_FN_SIZE_CONST_STRING_CONST_STRING, ATTR_PURE_NOTHROW_NONNULL_LEAF)
|
||||
DEF_EXT_LIB_BUILTIN (BUILT_IN_STRDUP, "strdup", BT_FN_STRING_CONST_STRING, ATTR_MALLOC_WARN_UNUSED_RESULT_NOTHROW_NONNULL_LEAF)
|
||||
DEF_EXT_LIB_BUILTIN (BUILT_IN_STRNDUP, "strndup", BT_FN_STRING_CONST_STRING_SIZE, ATTR_MALLOC_WARN_UNUSED_RESULT_NOTHROW_NONNULL_LEAF)
|
||||
DEF_C2X_BUILTIN (BUILT_IN_STRDUP, "strdup", BT_FN_STRING_CONST_STRING, ATTR_MALLOC_WARN_UNUSED_RESULT_NOTHROW_NONNULL_LEAF)
|
||||
DEF_C2X_BUILTIN (BUILT_IN_STRNDUP, "strndup", BT_FN_STRING_CONST_STRING_SIZE, ATTR_MALLOC_WARN_UNUSED_RESULT_NOTHROW_NONNULL_LEAF)
|
||||
DEF_LIB_BUILTIN (BUILT_IN_STRLEN, "strlen", BT_FN_SIZE_CONST_STRING, ATTR_PURE_NOTHROW_NONNULL_LEAF)
|
||||
DEF_EXT_LIB_BUILTIN (BUILT_IN_STRNCASECMP, "strncasecmp", BT_FN_INT_CONST_STRING_CONST_STRING_SIZE, ATTR_PURE_NOTHROW_NONNULL_LEAF)
|
||||
DEF_LIB_BUILTIN (BUILT_IN_STRNCAT, "strncat", BT_FN_STRING_STRING_CONST_STRING_SIZE, ATTR_RET1_NOTHROW_NONNULL_LEAF)
|
||||
|
|
|
@ -378,7 +378,8 @@ enum function_class {
|
|||
function_c99_misc,
|
||||
function_c99_math_complex,
|
||||
function_sincos,
|
||||
function_c11_misc
|
||||
function_c11_misc,
|
||||
function_c2x_misc
|
||||
};
|
||||
|
||||
/* Enumerate visibility settings. This is deliberately ordered from most
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2019-10-04 Joseph Myers <joseph@codesourcery.com>
|
||||
|
||||
* lto-lang.c (flag_isoc2x): New variable.
|
||||
|
||||
2019-09-18 Richard Biener <rguenther@suse.de>
|
||||
|
||||
PR lto/91763
|
||||
|
|
|
@ -247,6 +247,7 @@ static GTY(()) tree signed_size_type_node;
|
|||
int flag_isoc94;
|
||||
int flag_isoc99;
|
||||
int flag_isoc11;
|
||||
int flag_isoc2x;
|
||||
|
||||
/* Attribute handlers. */
|
||||
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2019-10-04 Joseph Myers <joseph@codesourcery.com>
|
||||
|
||||
* gcc.dg/c11-builtins-1.c, gcc.dg/c2x-builtins-1.c,
|
||||
gcc.dg/dfp/c2x-builtins-dfp-1.c: New tests.
|
||||
|
||||
2019-10-04 Mark Eggleston <mark.eggleston@codethink.com>
|
||||
|
||||
* gfortran.dg/auto_in_equiv_1.f90: Replaced.
|
||||
|
|
19
gcc/testsuite/gcc.dg/c11-builtins-1.c
Normal file
19
gcc/testsuite/gcc.dg/c11-builtins-1.c
Normal file
|
@ -0,0 +1,19 @@
|
|||
/* Test C11 built-in functions: test functions new in C2x are not
|
||||
declared as built-in for C11. */
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-std=c11" } */
|
||||
|
||||
int exp10 (void);
|
||||
int exp10f (void);
|
||||
int exp10l (void);
|
||||
int fabsd32 (void);
|
||||
int fabsd64 (void);
|
||||
int fabsd128 (void);
|
||||
int nand32 (void);
|
||||
int nand64 (void);
|
||||
int nand128 (void);
|
||||
int roundeven (void);
|
||||
int roundevenf (void);
|
||||
int roundevenl (void);
|
||||
int strdup (void);
|
||||
int strndup (void);
|
13
gcc/testsuite/gcc.dg/c2x-builtins-1.c
Normal file
13
gcc/testsuite/gcc.dg/c2x-builtins-1.c
Normal file
|
@ -0,0 +1,13 @@
|
|||
/* Test C2x built-in functions: test functions new in C2x are indeed
|
||||
declared as built-in as expected. Non-DFP tests. */
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-std=c2x" } */
|
||||
|
||||
int exp10 (void); /* { dg-warning "conflicting types for built-in function" } */
|
||||
int exp10f (void); /* { dg-warning "conflicting types for built-in function" } */
|
||||
int exp10l (void); /* { dg-warning "conflicting types for built-in function" } */
|
||||
int roundeven (void); /* { dg-warning "conflicting types for built-in function" } */
|
||||
int roundevenf (void); /* { dg-warning "conflicting types for built-in function" } */
|
||||
int roundevenl (void); /* { dg-warning "conflicting types for built-in function" } */
|
||||
int strdup (void); /* { dg-warning "conflicting types for built-in function" } */
|
||||
int strndup (void); /* { dg-warning "conflicting types for built-in function" } */
|
11
gcc/testsuite/gcc.dg/dfp/c2x-builtins-dfp-1.c
Normal file
11
gcc/testsuite/gcc.dg/dfp/c2x-builtins-dfp-1.c
Normal file
|
@ -0,0 +1,11 @@
|
|||
/* Test C2x built-in functions: test functions new in C2x are indeed
|
||||
declared as built-in as expected. DFP tests. */
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-std=c2x" } */
|
||||
|
||||
int fabsd32 (void); /* { dg-warning "conflicting types for built-in function" } */
|
||||
int fabsd64 (void); /* { dg-warning "conflicting types for built-in function" } */
|
||||
int fabsd128 (void); /* { dg-warning "conflicting types for built-in function" } */
|
||||
int nand32 (void); /* { dg-warning "conflicting types for built-in function" } */
|
||||
int nand64 (void); /* { dg-warning "conflicting types for built-in function" } */
|
||||
int nand128 (void); /* { dg-warning "conflicting types for built-in function" } */
|
Loading…
Add table
Reference in a new issue