Commit Graph

11 Commits

Author SHA1 Message Date
Kazu Hirata 2b72593e40 builtin-attrs.def: Fix comment formatting.
* builtin-attrs.def: Fix comment formatting.
	* c-pretty-print.c: Likewise.
	* diagnostic.h: Likewise.
	* langhooks.h: Likewise.
	* recog.c: Likewise.
	* simplify-rtx.c: Likewise.
	* tree.def: Likewise.

From-SVN: r70676
2003-08-22 06:25:09 +00:00
Roger Sayle 178b2b9f0f builtin-types.def (BT_SSIZE): New primitive type.
* 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
2003-08-03 03:23:18 +00:00
Kaveh R. Ghazi 280c1e0d23 builtin-attrs.def (gcc_diag, [...]): New format attributes.
gcc:
	* builtin-attrs.def (gcc_diag, gcc_cdiag, gcc_cxxdiag): New
	format attributes.
	* c-format.c (enum format_type): Add gcc_diag_format_type,
	gcc_cdiag_format_type, and gcc_cxxdiag_format_type.
	(gcc_diag_length_specs, gcc_cdiag_length_specs,
	gcc_cxxdiag_length_specs, gcc_diag_flag_pairs,
	gcc_cdiag_flag_pairs, gcc_cxxdiag_flag_pairs, gcc_diag_flag_specs,
	gcc_cdiag_flag_specs, gcc_cxxdiag_flag_specs, gcc_diag_char_table,
	gcc_cdiag_char_table, gcc_cxxdiag_char_table): New.
	(format_types_orig): Add new data.
	(find_char_info_specifier_index, init_dynamic_diag_info): New
	functions.
	(handle_format_attribute): Update to handle new format attributes.

testsuite:
	* gcc.dg/format/gcc_diag-1.c: New test.

From-SVN: r68689
2003-06-30 00:31:21 +00:00
Kaveh R. Ghazi 9a23858679 builtin-attrs.def, [...]: Don't use macros from "symcat.h", instead rely on ISO C.
* builtin-attrs.def, builtin-attrs.def, builtins.c, cpplex.c,
	cpplib.c, gencheck.c, gengenrtl.c, machmode.def, protoize.c: Don't
	use macros from "symcat.h", instead rely on ISO C.

	* system.h: Don't include "symcat.h".
	* configure.in (AC_C_STRINGIZE): Delete.
	* config.in, configure: Regenerate.

From-SVN: r68035
2003-06-16 19:14:22 +00:00
Kaveh R. Ghazi 3ae1d4c240 builtin-attrs.def (ATTR_ASM_FPRINTF): New.
* builtin-attrs.def (ATTR_ASM_FPRINTF): New.
	* c-format.c (enum format_type): Add asm_fprintf_format_type.
	(NOARGUMENTS, asm_fprintf_length_specs, asm_fprintf_flag_specs,
	asm_fprintf_flag_pairs, asm_fprintf_char_table): New.
	(format_types_orig): Renamed from format_types.  Add new data.
	(format_types): Declare as pointer.
	(handle_format_attribute): Move later in file so we have all
	necessary declarations.  Add section to capture HOST_WIDE_INT.
	* output.h (ATTRIBUTE_ASM_FPRINTF, __gcc_host_wide_int__): New.
	(asm_fprintf): Mark with ATTRIBUTE_ASM_FPRINTF.

From-SVN: r67319
2003-06-02 01:41:05 +00:00
Kaveh R. Ghazi 003620645c builtin-attrs.def (ATTR_NOTHROW_NONNULL_1, [...]): Renamed from ATTR_NONNULL_1, ATTR_NONNULL_2 and ATTR_NONNULL_3.
gcc:
	* builtin-attrs.def (ATTR_NOTHROW_NONNULL_1,
	ATTR_NOTHROW_NONNULL_2, ATTR_NOTHROW_NONNULL_3): Renamed from
	ATTR_NONNULL_1, ATTR_NONNULL_2 and ATTR_NONNULL_3.

	(ATTR_NOTHROW_NONNULL_1_2, ATTR_NOTHROW_NONNULL_1_4,
	ATTR_CONST_NOTHROW_NONNULL_1, ATTR_PURE_NOTHROW_NONNULL_1,
	ATTR_PURE_NOTHROW_NONNULL_1_2, ATTR_MALLOC_NOTHROW_NONNULL_1):
	New.

	* builtins.def (DEF_EXT_FALLBACK_BUILTIN): Accept ATTRS argument.
	(BUILT_IN_BZERO, BUILT_IN_BCOPY, BUILT_IN_BCMP): Update comment

	(BUILT_IN_INDEX, BUILT_IN_RINDEX, BUILT_IN_MEMCPY,
	BUILT_IN_MEMMOVE, BUILT_IN_MEMCMP, BUILT_IN_MEMSET,
	BUILT_IN_MEMPCPY, BUILT_IN_STRCAT, BUILT_IN_STRNCAT,
	BUILT_IN_STPCPY, BUILT_IN_STRCPY, BUILT_IN_STRNCPY,
	BUILT_IN_STRCMP, BUILT_IN_STRNCMP, BUILT_IN_STRLEN,
	BUILT_IN_STRSTR, BUILT_IN_STRPBRK, BUILT_IN_STRSPN,
	BUILT_IN_STRCSPN, BUILT_IN_STRCHR, BUILT_IN_STRRCHR, BUILT_IN_NAN,
	BUILT_IN_NANF, BUILT_IN_NANL, BUILT_IN_NANS, BUILT_IN_NANSF,
	BUILT_IN_NANSL, BUILT_IN_PUTS, BUILT_IN_FPUTC, BUILT_IN_FPUTS,
	BUILT_IN_FWRITE, BUILT_IN_PUTS_UNLOCKED, BUILT_IN_FPUTC_UNLOCKED,
	BUILT_IN_FPUTS_UNLOCKED, BUILT_IN_FWRITE_UNLOCKED,
	BUILT_IN_STRDUP): Add "nonnull" attribute.

testsuite:
	* gcc.dg/nonnull-3.c: New test.

From-SVN: r66468
2003-05-04 22:18:17 +00:00
Roger Sayle 0829165849 re PR c++/9367 (error: nonnull argument with extern "C" snprintf prototype)
PR c++/9367
	* builtin-types.def (DEF_FUNCTION_TYPE_VAR_3): New macro.
	(BT_FN_INT_CONST_STRING_VALIST_ARG,
	BT_FN_INT_STRING_CONST_STRING_VALIST_ARG,
	BT_FN_INT_CONST_STRING_CONST_STRING_VALIST_ARG,
	BT_FN_INT_STRING_SIZE_CONST_STRING_VALIST_ARG,
	BT_FN_INT_STRING_CONST_STRING_VAR,
	BT_FN_INT_CONST_STRING_CONST_STRING_VAR,
	BT_FN_INT_STRING_SIZE_CONST_STRING_VAR): New built-in types.
	* builtin-attrs.def (ATTR_NONNULL_1, ATTR_NONNULL_2,
	ATTR_NONNULL_3): Also include the nothrow attribute.
	(sprintf, scanf, sscanf, vprintf, vsprintf, snprintf,
	vsnprintf, vscanf, vsscanf): Don't define attributes here.
	* builtins.def (putchar, puts): Make full C89 built-ins.
	(snprintf, sprintf, scanf, sscanf, vprintf, vscanf,
	vsscanf, vsnprintf, vsprintf): New built-ins.
	* c-common.c (c_common_nodes_and_builtins): Handle new macro
	DEF_FUNCTION_TYPE_VAR_3.

	* doc/extend.texi: Document these new built-in functions.

	* java/builtins.c (builtin_type): Handle DEF_FUNCTION_TYPE_VAR_3.
	(initialize_builtins): Handle DEF_FUNCTION_TYPE_VAR_3.

	* g++.old-deja/g++.other/builtins10.C: New test for PR 9367.
	* gcc.dg/format/attr-5.c: Handle new conflicting types warning.

From-SVN: r63650
2003-03-02 01:34:34 +00:00
Roger Sayle df061a43b6 re PR c++/7099 (G++ doesn't set the noreturn attribute on std::exit and std::abort)
PR c++/7099
	* builtin-attrs.def: Define new attribute lists for use in
	builtins.def.
	* builtins.def [DEF_BUILTIN]: Modify to take an additional
	ATTRS argument, an enumerated value defined in builtin-attrs.def
	that represents the attribute list for the builtins.  Modify
	all builtin functions to pass an appropriate attribute list.
	Specify "abort", "exit", "_exit" and "_Exit" builtins here with
	their required noreturn attributes.
	* tree.h (enum_builtin_function): Ignore the additional parameter
	to DEF_BUILTIN.
	* builtins.c (built_in_names): Likewise.
	* c-common.c: (builtin_function_2): Replace the "int noreturn_p"
	argument with a tree representing the functions attribute list.
	Pass this "attrs" argument to builtin_function.  No longer handle
	the noreturn_p processing manually.
	(built_in_attributes): Move the definitions from builtin-attrs.def
	before c_common_nodes_and_builtins.
	(c_common_nodes_and_builtins): Handle the new ATTRS parameter in
	DEF_BUILTIN, passing it to both builtin_function and the changed
	builtin_function_2.

	* doc/extend.texi: Document __builtin_abort, __builtin_exit,
	__builtin__exit and __builtin__Exit.

	* java/builtins.c (initialize_builtins): Ignore the additional
	parameter to DEF_BUILTIN.  Handle more C/C++ specific junk in
	the builtins.def file.

From-SVN: r55276
2002-07-06 00:16:44 +00:00
Jason Thorpe 79ed7328ef builtin-attrs.def: Update copyright years.
* builtin-attrs.def: Update copyright years.
(ATTR_NONNULL): New attribute identifier.
(ATTR_NONNULL_1, ATTR_NONNULL_2, ATTR_NONNULL_3): New
attribute tree lists.
(DEF_FORMAT_ATTRIBUTE): Chain a nonnull attribute for the
format operand.
(ATTR_FORMAT_ARG_1, ATTR_FORMAT_ARG_2): Use...
(DEF_FORMAT_ARG_ATTRIBUTE): ...this to generate format_arg
attribute lists.  Chain the appropriate nonnull attribute.
* c-format.c (check_format_arg): Remove null format string
warning.
* testsuite/gcc.dg/format/null-1.c: New test.

From-SVN: r53801
2002-05-23 18:32:12 +00:00
Kaveh R. Ghazi b4c984fbec builtin-attrs.def (__builtin_printf_unlocked, [...]): Mark with the __printf__ attribute.
* builtin-attrs.def (__builtin_printf_unlocked,
	__builtin_fprintf_unlocked, printf_unlocked, fprintf_unlocked):
	Mark with the __printf__ attribute.

	* builtins.c (expand_builtin_fputs): Add an `unlocked' parameter
	and set the replacement function depending on it.
	(expand_builtin): Skip BUILT_IN_*_UNLOCKED when not optimizing.
	Handle BUILT_IN_*_UNLOCKED when optimizing.

	* builtins.def (DEF_EXT_FALLBACK_BUILTIN,
	DEF_EXT_FRONT_END_LIB_BUILTIN): New macros.
	Declare the "unlocked" stdio functions.

	* c-common.c (c_expand_builtin_printf, c_expand_builtin_fprintf):
	Add an `unlocked' parameter and set the replacement function
	depending on it.
	(c_expand_builtin): Handle BUILT_IN_PRINTF_UNLOCKED and
	BUILT_IN_FPRINTF_UNLOCKED.

	* doc/extend.texi (printf_unlocked, fprintf_unlocked,
	fputs_unlocked): Document.

testsuite:
	* gcc.dg/format/builtin-1.c: Test unlocked stdio.
	* gcc.dg/format/c90-printf-3.c: Likewise.
	* gcc.dg/format/c99-printf-3.c: Likewise.
	* gcc.dg/format/ext-1.c: Likewise.
	* gcc.dg/format/ext-6.c: Likewise.
	* gcc.dg/format/format.h: Prototype unlocked stdio.

From-SVN: r48229
2001-12-21 02:36:37 +00:00
Joseph Myers 6431177a55 attribs.c (decl_attributes): Possibly call insert_default_attributes to insert default attributes on...
* attribs.c (decl_attributes): Possibly call
	insert_default_attributes to insert default attributes on
	functions in a lazy manner.
	* builtin-attrs.def: New file; define the default format and
	format_arg attributes.
	* c-common.c (c_format_attribute_table): Move to earlier in the
	file.
	(c_common_nodes_and_builtins): Initialize format_attribute_table.
	(enum built_in_attribute, built_in_attributes,
	c_attrs_initialized, c_init_attributes,
	c_common_insert_default_attributes): New.
	(c_common_lang_init): Don't initialize format_attribute_table.  Do
	call c_init_attributes.
	* Makefile.in (c-common.o): Depend on builtin-attrs.def.
	* c-common.h (init_function_format_info): Don't declare.
	(c_common_insert_default_attributes): Declare.
	* c-decl.c (implicitly_declare, builtin_function): Call
	decl_attributes.
	(init_decl_processing): Don't call init_function_format_info.
	(insert_default_attributes): New.
	* c-format.c (handle_format_attribute,
	handle_format_arg_attribute): Be quiet about inappropriate
	declaration when applying default attributes.
	(init_function_format_info): Remove.
	* tree.h (enum attribute_flags): Add ATTR_FLAG_BUILT_IN.
	(insert_default_attributes): Declare.

cp:
	* decl.c (init_decl_processing): Don't call
	init_function_format_info.  Initialize lang_attribute_table
	earlier.
	(builtin_function): Call decl_attributes.
	(insert_default_attributes): New.

testsuite:
	* gcc.dg/format/attr-5.c, gcc.dg/format/attr-6.c: New tests.

From-SVN: r45942
2001-10-02 08:12:25 +01:00