]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
builtin-types.def (BT_SSIZE): New primitive type.
authorRoger Sayle <roger@eyesopen.com>
Sun, 3 Aug 2003 03:23:18 +0000 (03:23 +0000)
committerRoger Sayle <sayle@gcc.gnu.org>
Sun, 3 Aug 2003 03:23:18 +0000 (03:23 +0000)
* builtin-types.def (BT_SSIZE): New primitive type.
(BT_FN_INT_PTR_CONST_STRING_VALIST_ARG,
BT_FN_STRING_CONST_STRING_CONST_STRING_INT,
BT_FN_SIZE_STRING_SIZE_CONST_STRING_CONST_PTR,
BT_FN_SSIZE_STRING_SIZE_CONST_STRING_VAR): New function types.
* builtins.def (BUILT_IN_DCGETTEXT, BUILT_IN_DGETTEXT,
BUILT_IN_FSCANF, BUILT_IN_GETTEXT, BUILT_IN_STRFMON,
BUILT_IN_STRFTIME, BUILT_IN_VFPRINTF, BUILT_IN_VFSCANF): New builtins.
* builtin-attrs.def: Remove DEF_FN_ATTR construct and the last
few functions that define default attributes using it.
* c-common.c (c_common_insert_default_attributes): Do nothing.

* doc/extend.texi: Document these "new" builtins.

From-SVN: r70113

gcc/ChangeLog
gcc/builtin-attrs.def
gcc/builtin-types.def
gcc/builtins.def
gcc/c-common.c
gcc/doc/extend.texi

index 3fe67d0f8bbe9c264f204e2064b1d25866f67416..e9e340f8a76d1683a711c99f8dea7739c9efbbd7 100644 (file)
@@ -1,3 +1,19 @@
+2003-08-02  Roger Sayle  <roger@eyesopen.com>
+
+       * builtin-types.def (BT_SSIZE): New primitive type.
+       (BT_FN_INT_PTR_CONST_STRING_VALIST_ARG,
+       BT_FN_STRING_CONST_STRING_CONST_STRING_INT,
+       BT_FN_SIZE_STRING_SIZE_CONST_STRING_CONST_PTR,
+       BT_FN_SSIZE_STRING_SIZE_CONST_STRING_VAR): New function types.
+       * builtins.def (BUILT_IN_DCGETTEXT, BUILT_IN_DGETTEXT,
+       BUILT_IN_FSCANF, BUILT_IN_GETTEXT, BUILT_IN_STRFMON,
+       BUILT_IN_STRFTIME, BUILT_IN_VFPRINTF, BUILT_IN_VFSCANF): New builtins.
+       * builtin-attrs.def: Remove DEF_FN_ATTR construct and the last
+       few functions that define default attributes using it.
+       * c-common.c (c_common_insert_default_attributes): Do nothing.
+
+       * doc/extend.texi: Document these "new" builtins.
+
 2003-08-02  Kaz Kojima  <kkojima@gcc.gnu.org>
 
        * config/sh/linux.h (SUBTARGET_LINK_SPEC): Don't set rpath.
index 7156fcef994394b54f5c140e04599d338f2e4da2..66f75187ad6c040cbce3b7dd00f8d589e79abb3d 100644 (file)
@@ -41,13 +41,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
    DEF_ATTR_TREE_LIST (ENUM, PURPOSE, VALUE, CHAIN)
 
      Constructs a TREE_LIST with given PURPOSE, VALUE and CHAIN (given
-     as previous ENUM names).
-
-   DEF_FN_ATTR (NAME, ATTRS, PREDICATE)
-
-     Specifies that the function with name NAME (a previous ENUM for an
-     IDENTIFIER_NODE) has attributes ATTRS (a previous ENUM) if
-     PREDICATE is true.  */
+     as previous ENUM names).  */
 
 DEF_ATTR_NULL_TREE (ATTR_NULL)
 
@@ -157,43 +151,3 @@ DEF_FORMAT_ARG_ATTRIBUTE(1)
 DEF_FORMAT_ARG_ATTRIBUTE(2)
 #undef DEF_FORMAT_ARG_ATTRIBUTE
 
-/* Define an attribute for a function, along with the IDENTIFIER_NODE.  */
-#define DEF_FN_ATTR_IDENT(NAME, ATTRS, PREDICATE)      \
-  DEF_ATTR_IDENT (ATTR_##NAME, #NAME)                  \
-  DEF_FN_ATTR (ATTR_##NAME, ATTRS, PREDICATE)
-
-/* The ISO C functions are always checked (whether <stdio.h> is
-   included or not), since it is common to call printf without
-   including <stdio.h>.  There shouldn't be a problem with this,
-   since ISO C reserves these function names whether you include the
-   header file or not.  In any case, the checking is harmless.  With
-   -ffreestanding, these default attributes are disabled, and must be
-   specified manually if desired.  */
-
-/* Functions from ISO/IEC 9899:1990.  */
-#define DEF_C89_ATTR(NAME, ATTRS) DEF_FN_ATTR_IDENT (NAME, ATTRS, flag_hosted)
-DEF_C89_ATTR (fscanf, ATTR_FORMAT_SCANF_2_3)
-DEF_C89_ATTR (vfprintf, ATTR_FORMAT_PRINTF_2_0)
-DEF_C89_ATTR (strftime, ATTR_FORMAT_STRFTIME_3_0)
-#undef DEF_C89_ATTR
-
-/* ISO C99 adds the snprintf and vscanf family functions.  */
-#define DEF_C99_ATTR(NAME, ATTRS)                                          \
-  DEF_FN_ATTR_IDENT (NAME, ATTRS,                                          \
-              (flag_hosted                                                 \
-               && (flag_isoc99 || flag_noniso_default_format_attributes)))
-DEF_C99_ATTR (vfscanf, ATTR_FORMAT_SCANF_2_0)
-#undef DEF_C99_ATTR
-
-/* Functions not in any version of ISO C.  */
-#define DEF_EXT_ATTR(NAME, ATTRS)                                      \
-  DEF_FN_ATTR_IDENT (NAME, ATTRS,                                      \
-              flag_hosted && flag_noniso_default_format_attributes)
-/* Uniforum/GNU gettext functions.  */
-DEF_EXT_ATTR (gettext, ATTR_FORMAT_ARG_1)
-DEF_EXT_ATTR (dgettext, ATTR_FORMAT_ARG_2)
-DEF_EXT_ATTR (dcgettext, ATTR_FORMAT_ARG_2)
-/* X/Open strfmon function.  */
-DEF_EXT_ATTR (strfmon, ATTR_FORMAT_STRFMON_3_4)
-#undef DEF_EXT_ATTR
-#undef DEF_FN_ATTR_IDENT
index f5d90c332cf082d0e8c936e5354452020679ff4f..c587b757ade04c4d349985d5040f3e1104103dce 100644 (file)
@@ -76,6 +76,7 @@ DEF_PRIMITIVE_TYPE (BT_PTR, ptr_type_node)
 DEF_PRIMITIVE_TYPE (BT_CONST_PTR, const_ptr_type_node)
 DEF_PRIMITIVE_TYPE (BT_PTRMODE, (*lang_hooks.types.type_for_mode)(ptr_mode, 0))
 DEF_PRIMITIVE_TYPE (BT_SIZE, size_type_node)
+DEF_PRIMITIVE_TYPE (BT_SSIZE, signed_size_type_node)
 DEF_PRIMITIVE_TYPE (BT_STRING, string_type_node)
 DEF_PRIMITIVE_TYPE (BT_CONST_STRING, const_string_type_node)
 
@@ -183,11 +184,17 @@ DEF_FUNCTION_TYPE_3 (BT_FN_INT_STRING_CONST_STRING_VALIST_ARG,
                     BT_INT, BT_STRING, BT_CONST_STRING, BT_VALIST_ARG)
 DEF_FUNCTION_TYPE_3 (BT_FN_INT_CONST_STRING_CONST_STRING_VALIST_ARG,
                     BT_INT, BT_CONST_STRING, BT_CONST_STRING, BT_VALIST_ARG)
+DEF_FUNCTION_TYPE_3 (BT_FN_INT_PTR_CONST_STRING_VALIST_ARG,
+                    BT_INT, BT_PTR, BT_CONST_STRING, BT_VALIST_ARG)
+DEF_FUNCTION_TYPE_3 (BT_FN_STRING_CONST_STRING_CONST_STRING_INT,
+                    BT_STRING, BT_CONST_STRING, BT_CONST_STRING, BT_INT)
 
 DEF_FUNCTION_TYPE_4 (BT_FN_SIZE_CONST_PTR_SIZE_SIZE_PTR,
                     BT_SIZE, BT_CONST_PTR, BT_SIZE, BT_SIZE, BT_PTR)
 DEF_FUNCTION_TYPE_4 (BT_FN_INT_STRING_SIZE_CONST_STRING_VALIST_ARG,
                BT_INT, BT_STRING, BT_SIZE, BT_CONST_STRING, BT_VALIST_ARG)
+DEF_FUNCTION_TYPE_4 (BT_FN_SIZE_STRING_SIZE_CONST_STRING_CONST_PTR,
+               BT_SIZE, BT_STRING, BT_SIZE, BT_CONST_STRING, BT_CONST_PTR)
 
 DEF_FUNCTION_TYPE_VAR_0 (BT_FN_VOID_VAR, BT_VOID)
 DEF_FUNCTION_TYPE_VAR_0 (BT_FN_INT_VAR, BT_INT)
@@ -209,6 +216,8 @@ DEF_FUNCTION_TYPE_VAR_2 (BT_FN_INT_CONST_STRING_CONST_STRING_VAR,
 
 DEF_FUNCTION_TYPE_VAR_3 (BT_FN_INT_STRING_SIZE_CONST_STRING_VAR,
                         BT_INT, BT_STRING, BT_SIZE, BT_CONST_STRING)
+DEF_FUNCTION_TYPE_VAR_3 (BT_FN_SSIZE_STRING_SIZE_CONST_STRING_VAR,
+                        BT_SSIZE, BT_STRING, BT_SIZE, BT_CONST_STRING)
 
 DEF_POINTER_TYPE (BT_PTR_FN_VOID_VAR, BT_FN_VOID_VAR)
 DEF_FUNCTION_TYPE_3 (BT_FN_PTR_PTR_FN_VOID_VAR_PTR_SIZE,
index 74335e7992a58907ac898a13476cde9c53768194..6a62257935269808536a43092c3a135ca8e376f3 100644 (file)
@@ -247,6 +247,7 @@ DEF_LIB_BUILTIN        (BUILT_IN_FPUTC, "fputc", BT_FN_INT_INT_PTR, ATTR_NOTHROW
 DEF_EXT_LIB_BUILTIN    (BUILT_IN_FPUTC_UNLOCKED, "fputc_unlocked", BT_FN_INT_INT_PTR, ATTR_NOTHROW_NONNULL_2)
 DEF_LIB_BUILTIN        (BUILT_IN_FPUTS, "fputs", BT_FN_INT_CONST_STRING_PTR, ATTR_NOTHROW_NONNULL_1_2)
 DEF_EXT_LIB_BUILTIN    (BUILT_IN_FPUTS_UNLOCKED, "fputs_unlocked", BT_FN_INT_CONST_STRING_PTR, ATTR_NOTHROW_NONNULL_1_2)
+DEF_LIB_BUILTIN        (BUILT_IN_FSCANF, "fscanf", BT_FN_INT_PTR_CONST_STRING_VAR, ATTR_FORMAT_SCANF_2_3)
 DEF_LIB_BUILTIN        (BUILT_IN_FWRITE, "fwrite", BT_FN_SIZE_CONST_PTR_SIZE_SIZE_PTR, ATTR_NOTHROW_NONNULL_1_4)
 DEF_EXT_LIB_BUILTIN    (BUILT_IN_FWRITE_UNLOCKED, "fwrite_unlocked", BT_FN_SIZE_CONST_PTR_SIZE_SIZE_PTR, ATTR_NOTHROW_NONNULL_1_4)
 DEF_LIB_BUILTIN        (BUILT_IN_PRINTF, "printf", BT_FN_INT_CONST_STRING_VAR, ATTR_FORMAT_PRINTF_1_2)
@@ -259,6 +260,8 @@ DEF_LIB_BUILTIN        (BUILT_IN_SCANF, "scanf", BT_FN_INT_CONST_STRING_VAR, ATT
 DEF_C99_BUILTIN        (BUILT_IN_SNPRINTF, "snprintf", BT_FN_INT_STRING_SIZE_CONST_STRING_VAR, ATTR_FORMAT_PRINTF_3_4)
 DEF_LIB_BUILTIN        (BUILT_IN_SPRINTF, "sprintf", BT_FN_INT_STRING_CONST_STRING_VAR, ATTR_FORMAT_PRINTF_2_3)
 DEF_LIB_BUILTIN        (BUILT_IN_SSCANF, "sscanf", BT_FN_INT_CONST_STRING_CONST_STRING_VAR, ATTR_FORMAT_SCANF_2_3)
+DEF_LIB_BUILTIN        (BUILT_IN_VFPRINTF, "vfprintf", BT_FN_INT_PTR_CONST_STRING_VALIST_ARG, ATTR_FORMAT_PRINTF_2_0)
+DEF_C99_BUILTIN        (BUILT_IN_VFSCANF, "vfscanf", BT_FN_INT_PTR_CONST_STRING_VALIST_ARG, ATTR_FORMAT_SCANF_2_0)
 DEF_LIB_BUILTIN        (BUILT_IN_VPRINTF, "vprintf", BT_FN_INT_CONST_STRING_VALIST_ARG, ATTR_FORMAT_PRINTF_1_0)
 DEF_C99_BUILTIN        (BUILT_IN_VSCANF, "vscanf", BT_FN_INT_CONST_STRING_VALIST_ARG, ATTR_FORMAT_SCANF_1_0)
 DEF_C99_BUILTIN        (BUILT_IN_VSNPRINTF, "vsnprintf", BT_FN_INT_STRING_SIZE_CONST_STRING_VALIST_ARG, ATTR_FORMAT_PRINTF_3_0)
@@ -283,6 +286,8 @@ DEF_GCC_BUILTIN        (BUILT_IN_CONSTANT_P, "constant_p", BT_FN_INT_VAR, ATTR_C
 DEF_GCC_BUILTIN        (BUILT_IN_CTZ, "ctz", BT_FN_INT_INT, ATTR_CONST_NOTHROW_LIST)
 DEF_GCC_BUILTIN        (BUILT_IN_CTZL, "ctzl", BT_FN_INT_LONG, ATTR_CONST_NOTHROW_LIST)
 DEF_GCC_BUILTIN        (BUILT_IN_CTZLL, "ctzll", BT_FN_INT_LONGLONG, ATTR_CONST_NOTHROW_LIST)
+DEF_EXT_LIB_BUILTIN    (BUILT_IN_DCGETTEXT, "dcgettext", BT_FN_STRING_CONST_STRING_CONST_STRING_INT, ATTR_FORMAT_ARG_2)
+DEF_EXT_LIB_BUILTIN    (BUILT_IN_DGETTEXT, "dgettext", BT_FN_STRING_CONST_STRING_CONST_STRING, ATTR_FORMAT_ARG_2)
 DEF_GCC_BUILTIN        (BUILT_IN_DWARF_CFA, "dwarf_cfa", BT_FN_PTR, ATTR_NULL)
 DEF_GCC_BUILTIN        (BUILT_IN_DWARF_SP_COLUMN, "dwarf_sp_column", BT_FN_UNSIGNED, ATTR_NULL)
 DEF_GCC_BUILTIN        (BUILT_IN_EH_RETURN, "eh_return", BT_FN_VOID_PTRMODE_PTR, ATTR_NORETURN_NOTHROW_LIST)
@@ -292,6 +297,7 @@ DEF_GCC_BUILTIN        (BUILT_IN_EXPECT, "expect", BT_FN_LONG_LONG_LONG, ATTR_NU
 DEF_GCC_BUILTIN        (BUILT_IN_EXTRACT_RETURN_ADDR, "extract_return_addr", BT_FN_PTR_PTR, ATTR_NULL)
 DEF_GCC_BUILTIN        (BUILT_IN_FRAME_ADDRESS, "frame_address", BT_FN_PTR_UNSIGNED, ATTR_NULL)
 DEF_GCC_BUILTIN        (BUILT_IN_FROB_RETURN_ADDR, "frob_return_addr", BT_FN_PTR_PTR, ATTR_NULL)
+DEF_EXT_LIB_BUILTIN    (BUILT_IN_GETTEXT, "gettext", BT_FN_STRING_CONST_STRING, ATTR_FORMAT_ARG_1)
 DEF_GCC_BUILTIN        (BUILT_IN_INIT_DWARF_REG_SIZES, "init_dwarf_reg_size_table", BT_FN_VOID_PTR, ATTR_NULL)
 DEF_GCC_BUILTIN        (BUILT_IN_ISGREATER, "isgreater", BT_FN_INT_VAR, ATTR_CONST_NOTHROW_LIST)
 DEF_GCC_BUILTIN        (BUILT_IN_ISGREATEREQUAL, "isgreaterequal", BT_FN_INT_VAR, ATTR_CONST_NOTHROW_LIST)
@@ -314,6 +320,8 @@ DEF_GCC_BUILTIN        (BUILT_IN_RETURN_ADDRESS, "return_address", BT_FN_PTR_UNS
 DEF_GCC_BUILTIN        (BUILT_IN_SAVEREGS, "saveregs", BT_FN_PTR_VAR, ATTR_NULL)
 DEF_GCC_BUILTIN        (BUILT_IN_SETJMP, "setjmp", BT_FN_INT_PTR, ATTR_NULL)
 DEF_GCC_BUILTIN        (BUILT_IN_STDARG_START, "stdarg_start", BT_FN_VOID_VALIST_REF_VAR, ATTR_NULL)
+DEF_EXT_LIB_BUILTIN    (BUILT_IN_STRFMON, "strfmon", BT_FN_SSIZE_STRING_SIZE_CONST_STRING_VAR, ATTR_FORMAT_STRFMON_3_4)
+DEF_LIB_BUILTIN        (BUILT_IN_STRFTIME, "strftime", BT_FN_SIZE_STRING_SIZE_CONST_STRING_CONST_PTR, ATTR_FORMAT_STRFTIME_3_0)
 DEF_GCC_BUILTIN        (BUILT_IN_TRAP, "trap", BT_FN_VOID, ATTR_NORETURN_NOTHROW_LIST)
 DEF_GCC_BUILTIN        (BUILT_IN_UNWIND_INIT, "unwind_init", BT_FN_VOID, ATTR_NULL)
 DEF_GCC_BUILTIN        (BUILT_IN_VA_COPY, "va_copy", BT_FN_VOID_VALIST_REF_VALIST_ARG, ATTR_NULL)
index 8ee29b7a4eab56710a23571a5fe43bd4af8dd7ae..5dc87d78849bb4798554e9b609ca52dd663b597a 100644 (file)
@@ -4189,27 +4189,8 @@ c_init_attributes (void)
 /* Depending on the name of DECL, apply default attributes to it.  */
 
 void
-c_common_insert_default_attributes (tree decl)
+c_common_insert_default_attributes (tree decl ATTRIBUTE_UNUSED)
 {
-  tree name = DECL_NAME (decl);
-
-  if (!c_attrs_initialized)
-    c_init_attributes ();
-
-#define DEF_ATTR_NULL_TREE(ENUM) /* Nothing needed after initialization.  */
-#define DEF_ATTR_INT(ENUM, VALUE)
-#define DEF_ATTR_IDENT(ENUM, STRING)
-#define DEF_ATTR_TREE_LIST(ENUM, PURPOSE, VALUE, CHAIN)
-#define DEF_FN_ATTR(NAME, ATTRS, PREDICATE)                    \
-  if ((PREDICATE) && name == built_in_attributes[(int) NAME])  \
-    decl_attributes (&decl, built_in_attributes[(int) ATTRS],  \
-                    ATTR_FLAG_BUILT_IN);
-#include "builtin-attrs.def"
-#undef DEF_ATTR_NULL_TREE
-#undef DEF_ATTR_INT
-#undef DEF_ATTR_IDENT
-#undef DEF_ATTR_TREE_LIST
-#undef DEF_FN_ATTR
 }
 
 /* Output a -Wshadow warning MSGCODE about NAME, and give the location
index f636d33215da9f80ac71068f406e9c7ef71b8220..4ccc68b43e2e1e7661f809afb9b96b9884a2c314 100644 (file)
@@ -4745,6 +4745,8 @@ v4si f (v4si a, v4si b, v4si c)
 @findex creal
 @findex crealf
 @findex creall
+@findex dcgettext
+@findex dgettext
 @findex exit
 @findex _exit
 @findex _Exit
@@ -4765,6 +4767,8 @@ v4si f (v4si a, v4si b, v4si c)
 @findex fprintf_unlocked
 @findex fputs
 @findex fputs_unlocked
+@findex fscanf
+@findex gettext
 @findex imaxabs
 @findex index
 @findex labs
@@ -4808,6 +4812,8 @@ v4si f (v4si a, v4si b, v4si c)
 @findex strcpy
 @findex strcspn
 @findex strdup
+@findex strfmon
+@findex strftime
 @findex strlen
 @findex strncat
 @findex strncmp
@@ -4822,6 +4828,8 @@ v4si f (v4si a, v4si b, v4si c)
 @findex trunc
 @findex truncf
 @findex truncl
+@findex vfprintf
+@findex vfscanf
 @findex vprintf
 @findex vscanf
 @findex vsnprintf
@@ -4849,9 +4857,11 @@ be emitted.
 @opindex std
 Outside strict ISO C mode (@option{-ansi}, @option{-std=c89} or
 @option{-std=c99}), the functions @code{alloca}, @code{bcmp},
-@code{bzero}, @code{_exit}, @code{ffs}, @code{fprintf_unlocked},
-@code{fputs_unlocked}, @code{index}, @code{mempcpy}, @code{printf_unlocked},
-@code{rindex}, @code{stpcpy} and @code{strdup} 
+@code{bzero}, @code{dcgettext}, @code{dgettext}, @code{_exit},
+@code{ffs}, @code{fprintf_unlocked},
+@code{fputs_unlocked}, @code{gettext},
+@code{index}, @code{mempcpy}, @code{printf_unlocked},
+@code{rindex}, @code{stpcpy}, @code{strdup} and @code{strfmon}
 may be handled as built-in functions.
 All these functions have corresponding versions
 prefixed with @code{__builtin_}, which may be used even in strict C89
@@ -4865,7 +4875,7 @@ The ISO C99 functions
 @code{_Exit}, @code{imaxabs}, @code{llabs},
 @code{nearbyint}, @code{nearbyintf}, @code{nearbyintl},
 @code{round}, @code{roundf}, @code{roundl}, @code{snprintf},
-@code{trunc}, @code{truncf}, @code{truncl},
+@code{trunc}, @code{truncf}, @code{truncl}, @code{vfscanf},
 @code{vscanf}, @code{vsnprintf} and @code{vsscanf}
 are handled as built-in functions
 except in strict ISO C90 mode (@option{-ansi} or @option{-std=c89}).
@@ -4885,14 +4895,15 @@ corresponding versions prefixed with @code{__builtin_}.
 The ISO C90 functions @code{abort}, @code{abs}, @code{atan}, @code{atan2},
 @code{calloc}, @code{ceil}, @code{cos}, @code{exit},
 @code{exp}, @code{fabs}, @code{floor}, @code{fmod},
-@code{fprintf}, @code{fputs}, @code{labs}, @code{log}, @code{malloc},
+@code{fprintf}, @code{fputs}, @code{fscanf},
+@code{labs}, @code{log}, @code{malloc},
 @code{memcmp}, @code{memcpy}, @code{memset}, @code{pow}, @code{printf},
 @code{putchar}, @code{puts}, @code{scanf}, @code{sin}, @code{snprintf},
 @code{sprintf}, @code{sqrt}, @code{sscanf},
 @code{strcat}, @code{strchr}, @code{strcmp},
 @code{strcpy}, @code{strcspn}, @code{strlen}, @code{strncat}, @code{strncmp},
 @code{strncpy}, @code{strpbrk}, @code{strrchr}, @code{strspn}, @code{strstr},
-@code{tan}, @code{vprintf} and @code{vsprintf}
+@code{tan}, @code{vfprintf}, @code{vprintf} and @code{vsprintf}
 are all recognized as built-in functions unless
 @option{-fno-builtin} is specified (or @option{-fno-builtin-@var{function}}
 is specified for an individual function).  All of these functions have