Commit Graph

98 Commits

Author SHA1 Message Date
Manuel López-Ibáñez d723bb7c75 In cp/error.c...
In cp/error.c, I separate the initialization of the diagnostic context
from the initialization of the scratch pretty-printer (cxx_pp).  This
was suggested by Gabriel in the last review of the patch and now I
realize it was a good idea. Now cxx_initialize_diagnostics is the
equivalent version of c_initialize_diagnostics.  To avoid having to
make extern a bunch of functions, I moved it from cp-objcp-common.c to
error.c.

I moved the setting of diagnostic_format_decoder (global_dc) =
c_tree_printer, from c_objc_common_init to c_initialize_diagnostics,
and right after c_common_diagnostics_set_defaults.  This
mimics what is done in cxx_initialize_diagnostics.

Moreover, in both c_initialize_diagnostics and
cxx_initialize_diagnostics, the FE-specific pretty-printer is
initialized first and then other settings are applied. This does not
make a difference right now, but if in the future one wishes to touch
something in the pretty-printer, it will not get overriden
immediately.

In fact, the code I removed in c_common_initialize_diagnostics, which
sets line_cutoff to 80, is useless because the pretty-printer created
here is actually never used, but overriden by the FE-specific
pretty-printers. This also means that doc/invoke.texi was wrong.

Finally, it is useless to set the maximum line length to 0 in the
constructor of cxx_pretty_printer.  It is the default anyway.

gcc/c/ChangeLog:

2014-10-26  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR c++/53061
	* c-objc-common.c (c_objc_common_init): Do not do diagnostics
	initialization here...
	(c_initialize_diagnostics): ... but here. Set defaults after
	building pretty-printer.

gcc/ChangeLog:

2014-10-26  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR c++/53061
	* doc/invoke.texi (fmessage-length): Update text to match reality.

gcc/cp/ChangeLog:

2014-10-26  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR c++/53061
	* cp-objcp-common.c: Do not include new.
	(cxx_initialize_diagnostics): Move from here to ...
	* error.c (cxx_initialize_diagnostics): : ... here. Move
	diagnostics initialization here from init_error.
	(cxx_pp): Use a real pointer not a macro.
	(init_error): Just initialize cxx_pp.
	* cxx-pretty-print.c (cxx_pretty_printer::cxx_pretty_printer): Do
	not set maximum line length.

gcc/c-family/ChangeLog:

2014-10-26  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR c++/53061
	* c-opts.c (c_common_diagnostics_set_defaults): Renamed from
	c_common_initialize_diagnostics.
	* c-common.h: Likewise.

From-SVN: r216720
2014-10-26 21:21:58 +00:00
Marek Polacek 92574c7cdb c-opts.c (c_common_post_options): Set warn_implicit_int.
c-family/
	* c-opts.c (c_common_post_options): Set warn_implicit_int.
	* c.opt (Wimplicit-int): Initialize to -1.
c/
	* c-decl.c (grokdeclarator): Use OPT_Wimplicit_int unconditionally.
	(start_function): Use OPT_Wimplicit_int instead of 0.
	(store_parm_decls_oldstyle): Likewise.
testsuite/
	* gcc.dg/Wimplicit-int-1.c: New test.
	* gcc.dg/Wimplicit-int-2.c: New test.
	* gcc.dg/Wimplicit-int-3.c: New test.
	* gcc.dg/Wimplicit-int-4.c: New test.

From-SVN: r216412
2014-10-17 18:37:25 +00:00
Marek Polacek d73326ca59 invoke.texi: Update to reflect that GNU11 is the default mode for C.
* doc/invoke.texi: Update to reflect that GNU11 is the default
	mode for C.
	* c-common.h (c_language_kind): Update comment.
c-family/
	* c-opts.c (c_common_init_options): Make -std=gnu11 the default for C.

From-SVN: r216247
2014-10-15 10:08:00 +00:00
Manuel López-Ibáñez 737a4826d0 c.opt (Wpsabi): Use LangEnabledBy.
gcc/c-family/ChangeLog:

2014-09-15  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	* c.opt (Wpsabi): Use LangEnabledBy.
	* c-opts.c (c_common_handle_option): Do not handle here.

From-SVN: r215272
2014-09-15 16:32:50 +00:00
Manuel López-Ibáñez 1ef33fd4cd invoke.texi (Wnormalized=): Update.
gcc/ChangeLog:

2014-09-09  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	* doc/invoke.texi (Wnormalized=): Update.

libcpp/ChangeLog:

2014-09-09  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	* include/cpplib.h (struct cpp_options): Declare warn_normalize as
	int instead of enum.

gcc/c-family/ChangeLog:

2014-09-09  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	* c.opt	(Wnormalized): New.
	(Wnormalized=): Use Enum and Reject Negative.
	* c-opts.c (c_common_handle_option): Do not handle Wnormalized here.

gcc/testsuite/ChangeLog:

2014-09-09  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	* gcc.dg/cpp/warn-normalized-3.c: Delete useless dg-prune-output.

From-SVN: r215093
2014-09-09 21:41:43 +00:00
Manuel López-Ibáñez 2b71f4a4f8 options.texi: Document that Var and Init are required if CPP is given.
gcc/ChangeLog:

2014-09-04  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	* doc/options.texi: Document that Var and Init are required if CPP
	is given.
	* optc-gen.awk: Require Var and Init if CPP is given.
	* common.opt (Wpedantic): Use Init.

libcpp/ChangeLog:

2014-09-04  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	* macro.c (replace_args): Use cpp_pedwarning, cpp_warning and
	CPP_W flags.
	* include/cpplib.h: Add CPP_W_C90_C99_COMPAT and CPP_W_PEDANTIC.
	* init.c (cpp_create_reader): Do not init to -1 here.
	* expr.c (num_binary_op): Use cpp_pedwarning.

gcc/c-family/ChangeLog:

2014-09-04  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	* c.opt (Wc90-c99-compat,Wc++-compat,Wcomment,Wendif-labels,
	Winvalid-pch,Wlong-long,Wmissing-include-dirs,Wmultichar,Wpedantic,
	(Wdate-time,Wtraditional,Wundef,Wvariadic-macros): Add CPP, Var
	and Init.
	* c-opts.c (c_common_handle_option): Do not handle here.
	(sanitize_cpp_opts): Likewise.
	* c-common.c (struct reason_option_codes_t): Handle
	CPP_W_C90_C99_COMPAT and CPP_W_PEDANTIC.

gcc/testsuite/ChangeLog:

2014-09-04  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	* gcc.dg/cpp/endif-pedantic2.c: More general options do not
	override specific ones, but specific ones do.

From-SVN: r214904
2014-09-04 15:13:40 +00:00
Manuel López-Ibáñez 81b5d104e9 directives.c (check_eol_1): New.
libcpp/ChangeLog:

2014-08-29  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	* directives.c (check_eol_1): New.
	(check_eol_endif_labels): New.
	(check_eol): Call check_eol_1.
	(do_else,do_endif): Call check_eol_endif_labels.

gcc/c-family/ChangeLog:

2014-08-29  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	* c.opt (Wbuiltin-macro-redefined,Wdeprecated,Wendif-labels,
	Winvalid-pch,Wliteral-suffix,Wmissing-include-dirs,Wtrigraphs,
	Wundef): Use CPP, Var and Init.
	* c-opts.c (c_common_handle_option): Do not handle the above flags here.

From-SVN: r214735
2014-08-29 16:06:19 +00:00
Manuel López-Ibáñez b753b37bd6 macro.c (warn_of_redefinition): Suppress warnings for builtins that lack the NODE_WARN flag...
libcpp/ChangeLog:

2014-08-29  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	* macro.c (warn_of_redefinition): Suppress warnings for builtins
	that lack the NODE_WARN flag, unless Wbuiltin-macro-redefined.
	(_cpp_create_definition): Use Wbuiltin-macro-redefined for
	builtins that lack the NODE_WARN flag.
	* directives.c (do_undef): Likewise.
	* init.c (cpp_init_special_builtins): Do not change flags
	depending on Wbuiltin-macro-redefined.


gcc/c-family/ChangeLog:

2014-08-29  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	* c.opt (Wbuiltin-macro-redefined): Use CPP, Var and Init.
	* c-opts.c (c_common_handle_option): Do not handle here.

From-SVN: r214730
2014-08-29 15:28:45 +00:00
Jason Merrill 028aee171a c.opt: Change -std=c++1y and -std=gnu++1y to be aliases for -std=c++14 and -std=gnu++14...
* c.opt: Change -std=c++1y and -std=gnu++1y to be aliases for
	-std=c++14 and -std=gnu++14, rather than the reverse.
	* c-opts.c (c_common_handle_option): Change OPT_std_c__1y and
	OPT_std_gnu__1y to OPT_std_c__14 and OPT_std_gnu__14.
	* c-common.h (cxx_dialect): Remove cxx1y.

From-SVN: r214414
2014-08-25 01:05:01 -04:00
Edward Smith-Rowland e4276ba523 cpplib.h (enum c_lang): Add CLK_GNUCXX1Z, CLK_CXX1Z...
libcpp/

2014-08-23  Edward Smith-Rowland  <3dw4rd@verizon.net>

	* include/cpplib.h (enum c_lang): Add CLK_GNUCXX1Z, CLK_CXX1Z;
	Rename CLK_GNUCXX1Y, CLK_CXX1Y to CLK_GNUCXX14, CLK_CXX14;
	* init.c (struct lang_flags lang_defaults): Add column for trigraphs;
	Add rows for CLK_GNUCXX1Z, CLK_CXX1Z; (cpp_set_lang): Set trigraphs;
	(cpp_init_builtins): Set __cplusplus to 201402L for C++14;
	Set __cplusplus to 201500L for C++17.
	* expr.c (cpp_classify_number): Change C++1y to C++14 in binary
	constants error message.


gcc/c-family/

2014-08-23  Edward Smith-Rowland  <3dw4rd@verizon.net>

	* c-common.h (enum cxx_dialect): Add cxx14.
	* c-opts.c (set_std_cxx1y): Rename to set_std_cxx14; Use cxx14.
	* c-ubsan.c (ubsan_instrument_shift): Change comment and logic from
	cxx_dialect == cxx11 || cxx_dialect == cxx1y to cxx_dialect >= cxx11.


gcc/cp/

2014-08-23  Edward Smith-Rowland  <3dw4rd@verizon.net>

	* decl.c (compute_array_index_type, grokdeclarator,
	undeduced_auto_decl): Change from cxx1y to cxx14.
	*lambda.c(add_capture()): Change error message from C++1y to C++14.
	* parser.c (cp_parser_unqualified_id, cp_parser_pseudo_destructor_name,
	cp_parser_lambda_introducer, cp_parser_lambda_declarator_opt,
	cp_parser_decltype, cp_parser_conversion_type_id,
	cp_parser_simple_type_specifier, cp_parser_type_id_1,
	cp_parser_template_type_arg, cp_parser_std_attribute,
	cp_parser_template_declaration_after_export): Ditto.
	* pt.c (tsubst): Ditto.
	* semantics.c (force_paren_expr, finish_decltype_type): Ditto.
	* tree.c: Change comment.
	* typeck.c (comp_template_parms_position, cxx_sizeof_or_alignof_type,
	cp_build_addr_expr_1, maybe_warn_about_useless_cast): Ditto.


gcc/

2014-08-23  Edward Smith-Rowland  <3dw4rd@verizon.net>

	* doc/invoke.texi: Change c++1y to c++14 and gnu++1y to gnu++14.
	Deprecate c++1y. Change language to reflect greater confidence in C++14.


gcc/testsuite/

2014-08-23  Edward Smith-Rowland  <3dw4rd@verizon.net>

	* g++.dg/cpp0x/cplusplus.C: New.
	* g++.dg/cpp0x/cplusplus_0x.C: New.
	* g++.dg/cpp0x/auto3.C: Change c++1y to c++14.
	* g++.dg/cpp0x/auto41.C: Ditto.
	* g++.dg/cpp0x/auto9.C: Ditto.
	* g++.dg/cpp0x/initlist26.C: Ditto.
	* g++.dg/cpp0x/pr59111.C: Ditto.
	* g++.dg/cpp0x/trailing2.C: Ditto.
	* g++.dg/cpp1y/attr-deprecated.C: Ditto.
	* g++.dg/cpp1y/auto-dtor1.C: Ditto.
	* g++.dg/cpp1y/auto-fn1.C: Ditto.
	* g++.dg/cpp1y/auto-fn2.C: Ditto.
	* g++.dg/cpp1y/auto-fn3.C: Ditto.
	* g++.dg/cpp1y/auto-fn4.C: Ditto.
	* g++.dg/cpp1y/auto-fn5.C: Ditto.
	* g++.dg/cpp1y/auto-fn6.C: Ditto.
	* g++.dg/cpp1y/auto-fn7.C: Ditto.
	* g++.dg/cpp1y/auto-fn8.C: Ditto.
	* g++.dg/cpp1y/auto-fn9.C: Ditto.
	* g++.dg/cpp1y/auto-fn10.C: Ditto.
	* g++.dg/cpp1y/auto-fn11.C: Ditto.
	* g++.dg/cpp1y/auto-fn12.C: Ditto.
	* g++.dg/cpp1y/auto-fn13.C: Ditto.
	* g++.dg/cpp1y/auto-fn14.C: Ditto.
	* g++.dg/cpp1y/auto-fn15.C: Ditto.
	* g++.dg/cpp1y/auto-fn16.C: Ditto.
	* g++.dg/cpp1y/auto-fn17.C: Ditto.
	* g++.dg/cpp1y/auto-fn18.C: Ditto.
	* g++.dg/cpp1y/auto-fn19.C: Ditto.
	* g++.dg/cpp1y/auto-fn20.C: Ditto.
	* g++.dg/cpp1y/auto-fn21.C: Ditto.
	* g++.dg/cpp1y/auto-fn22.C: Ditto.
	* g++.dg/cpp1y/auto-fn23.C: Ditto.
	* g++.dg/cpp1y/auto-fn24.C: Ditto.
	* g++.dg/cpp1y/auto-fn25.C: Ditto.
	* g++.dg/cpp1y/auto-mangle1.C: Ditto.
	* g++.dg/cpp1y/auto-neg1.C: Ditto.
	* g++.dg/cpp1y/digit-sep.C: Ditto.
	* g++.dg/cpp1y/digit-sep-neg.C: Ditto.
	* g++.dg/cpp1y/digit-sep-cxx11-neg.C: Ditto.
	* g++.dg/cpp1y/fn-generic-member-ool.C: Ditto.
	* g++.dg/cpp1y/lambda-deduce-mult.C: Ditto.
	* g++.dg/cpp1y/lambda-generic.C: Ditto.
	* g++.dg/cpp1y/lambda-generic-cfun.C: Ditto.
	* g++.dg/cpp1y/lambda-generic-dep.C: Ditto.
	* g++.dg/cpp1y/lambda-generic-mixed.C: Ditto.
	* g++.dg/cpp1y/lambda-generic-udt.C: Ditto.
	* g++.dg/cpp1y/lambda-generic-variadic.C: Ditto.
	* g++.dg/cpp1y/lambda-generic-vla1.C: Ditto.
	* g++.dg/cpp1y/lambda-generic-x.C: Ditto.
	* g++.dg/cpp1y/lambda-generic-xcfun.C: Ditto.
	* g++.dg/cpp1y/lambda-generic-xudt.C: Ditto.
	* g++.dg/cpp1y/lambda-init.C: Ditto.
	* g++.dg/cpp1y/lambda-init1.C: Ditto.
	* g++.dg/cpp1y/lambda-init2.C: Ditto.
	* g++.dg/cpp1y/lambda-init3.C: Ditto.
	* g++.dg/cpp1y/lambda-init4.C: Ditto.
	* g++.dg/cpp1y/lambda-init5.C: Ditto.
	* g++.dg/cpp1y/lambda-init6.C: Ditto.
	* g++.dg/cpp1y/lambda-init7.C: Ditto.
	* g++.dg/cpp1y/lambda-init8.C: Ditto.
	* g++.dg/cpp1y/lambda-init9.C: Ditto.
	* g++.dg/cpp1y/mangle1.C: Ditto.
	* g++.dg/cpp1y/pr57640.C: Ditto.
	* g++.dg/cpp1y/pr57644.C: Ditto.
	* g++.dg/cpp1y/pr58500.C: Ditto.
	* g++.dg/cpp1y/pr58533.C: Ditto.
	* g++.dg/cpp1y/pr58534.C: Ditto.
	* g++.dg/cpp1y/pr58535.C: Ditto.
	* g++.dg/cpp1y/pr58536.C: Ditto.
	* g++.dg/cpp1y/pr58548.C: Ditto.
	* g++.dg/cpp1y/pr58549.C: Ditto.
	* g++.dg/cpp1y/pr58637.C: Ditto.
	* g++.dg/cpp1y/pr58708.C: Ditto.
	* g++.dg/cpp1y/pr59110.C: Ditto.
	* g++.dg/cpp1y/pr59112.C: Ditto.
	* g++.dg/cpp1y/pr59113.C: Ditto.
	* g++.dg/cpp1y/pr59629.C: Ditto.
	* g++.dg/cpp1y/pr59635.C: Ditto.
	* g++.dg/cpp1y/pr59636.C: Ditto.
	* g++.dg/cpp1y/pr59638.C: Ditto.
	* g++.dg/cpp1y/pr59867.C: Ditto.
	* g++.dg/cpp1y/pr60033.C: Ditto.
	* g++.dg/cpp1y/pr60052.C: Ditto.
	* g++.dg/cpp1y/pr60053.C: Ditto.
	* g++.dg/cpp1y/pr60054.C: Ditto.
	* g++.dg/cpp1y/pr60064.C: Ditto.
	* g++.dg/cpp1y/pr60065.C: Ditto.
	* g++.dg/cpp1y/pr60190.C: Ditto.
	* g++.dg/cpp1y/pr60311.C: Ditto.
	* g++.dg/cpp1y/pr60332.C: Ditto.
	* g++.dg/cpp1y/pr60376.C: Ditto.
	* g++.dg/cpp1y/pr60377.C: Ditto.
	* g++.dg/cpp1y/pr60384.C: Ditto.
	* g++.dg/cpp1y/pr60390.C: Ditto.
	* g++.dg/cpp1y/pr60391.C: Ditto.
	* g++.dg/cpp1y/pr60393.C: Ditto.
	* g++.dg/cpp1y/pr60573.C: Ditto.
	* g++.dg/cpp1y/pr60626.C: Ditto.
	* g++.dg/cpp1y/pr60627.C: Ditto.
	* g++.dg/cpp1y/regress1.C: Ditto.
	* g++.dg/cpp1y/system-binary-constants-1.C: Ditto.
	* g++.dg/cpp1y/udlit-char-template.C: Ditto.
	* g++.dg/cpp1y/udlit-char-template-neg.C: Ditto.
	* g++.dg/cpp1y/udlit-empty-string-neg.C: Ditto.
	* g++.dg/cpp1y/udlit-enc-prefix-neg.C: Ditto.
	* g++.dg/cpp1y/udlit-userdef-string.C: Ditto.
	* g++.dg/cpp1y/var-templ1.C: Ditto.
	* g++.dg/cpp1y/var-templ2.C: Ditto.
	* g++.dg/cpp1y/var-templ3.C: Ditto.
	* g++.dg/cpp1y/var-templ4.C: Ditto.
	* g++.dg/cpp1y/var-templ5.C: Ditto.
	* g++.dg/cpp1y/var-templ6.C: Ditto.
	* g++.dg/cpp1y/var-templ7.C: Ditto.
	* g++.dg/cpp1y/vla1.C: Ditto.
	* g++.dg/cpp1y/vla2.C: Ditto.
	* g++.dg/cpp1y/vla3.C: Ditto.
	* g++.dg/cpp1y/vla4.C: Ditto.
	* g++.dg/cpp1y/vla5.C: Ditto.
	* g++.dg/cpp1y/vla8.C: Ditto.
	* g++.dg/cpp1y/vla9.C: Ditto.
	* g++.dg/cpp1y/vla10.C: Ditto.
	* g++.dg/cpp1y/vla11.C: Ditto.
	* g++.dg/cpp1y/vla12.C: Ditto.
	* g++.dg/cpp1y/vla13.C: Ditto.
	* g++.dg/cpp1y/vla-initlist1.C: Ditto.
	* g++.dg/ext/vector23.C: Ditto.
	* g++.dg/ext/vla11.C: Ditto.
	* gcc/testsuite/g++.dg/ubsan/cxx1y-vla.C: Ditto.
	* g++.dg/warn/Wvla-2.C: Ditto.
	* g++.dg/debug/dwarf2/auto1.C: Ditto.
	* g++.dg/cpp1z/typename-tmpl-tmpl-parm-ped-neg.C: Ditto.
	* g++.dg/cpp1y/cplusplus.C: Check for exact date.
	* g++.dg/cpp1y/system-binary-constants-1.C: Check C++14 instead of C++1y
	in error message.
	* g++.dg/system-binary-constants-1.C: Ditto.
	* g++.dg/cpp1y/cplusplus_1y.C: New.
	* g++.dg/cpp1z/cplusplus.C: New.
	* lib/target-supports.exp:
	(check_effective_target_c++1y*): Rename to check_effective_target_c++14*
	(check_effective_target_c++11_only): Call check_effective_target_c++14;
	(check_effective_target_c++11_down): Ditto.

From-SVN: r214400
2014-08-23 16:50:22 +00:00
Manuel López-Ibáñez 596e808cf6 c.opt (Wcomment): Use CPP, Var and LangEnabledBy.
gcc/c-family/ChangeLog:

2014-08-22  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	* c.opt (Wcomment): Use CPP, Var and LangEnabledBy.
	(Wmultichar): Likewise.
	(Wdate-time): Use C-family languages instead of Common. Use CPP
	and Var.
	* c-opts.c (c_common_handle_option): Do not handle the above
	options here.
	(sanitize_cpp_opts): Likewise.

gcc/testsuite/ChangeLog:

2014-08-22  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	* g++.dg/warn/wdate-time.C: Remove.
	* gcc.dg/wdate-time.c: Move from here...
	* c-c++-common/wdate-time.c: ... to here.

From-SVN: r214350
2014-08-22 18:39:16 +00:00
Manuel López-Ibáñez 18767f6502 re PR fortran/44054 (Handle -Werror, -Werror=, -fdiagnostics-show-option, !GCC$ diagnostic (pragmas) and color)
gcc/ChangeLog:

2014-08-21  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR fortran/44054
	* diagnostic.c (default_diagnostic_finalizer): Move caret printing
	 to here ...
	(diagnostic_report_diagnostic): ... from here.
	* toplev.c (general_init): Move code to c-family.

gcc/cp/ChangeLog:

2014-08-21  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR fortran/44054
	* error.c (cp_diagnostic_finalizer): Delete.
	(init_error): Do not set diagnostic_finalizer here.

gcc/c-family/ChangeLog:

2014-08-21  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR fortran/44054
	* c-opts.c: Include tree-diagnostics.h.
	(c_diagnostic_finalizer): New.
	(c_common_initialize_diagnostics): Use it.

gcc/fortran/ChangeLog:

2014-08-21  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR fortran/44054
	* error.c (gfc_diagnostic_finalizer): Call default finalizer.

From-SVN: r214245
2014-08-20 23:07:29 +00:00
Manuel López-Ibáñez 43f9a13cee re PR preprocessor/60975 (-Wvariadic-macros does not print warning)
gcc/ChangeLog:

2014-08-20  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR c/60975
	PR c/53063
	* doc/options.texi (CPP): Document it.
	* doc/invoke.texi (Wvariadic-macros): Fix documentation.
	* optc-gen.awk: Handle CPP.
	* opth-gen.awk: Likewise.

gcc/c-family/ChangeLog:

2014-08-20  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR c/60975
	PR c/53063
	* c.opt (Wvariadic-macros): Use CPP and LangEnabledBy.
	* c-opts.c (c_common_handle_option): Call cpp_handle_option_auto.
	(c_common_post_options): Call init_global_opts_from_cpp.
	(sanitize_cpp_opts): Do not handle Wvariadic-macros here.

gcc/testsuite/ChangeLog:

2014-08-20  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR c/60975
	PR c/53063
	* gcc.dg/cpp/Wvariadic-1p.c: New test.

From-SVN: r214200
2014-08-19 22:37:49 +00:00
Marek Polacek 177cce463d c-opts.c (sanitize_cpp_opts): Make warn_long_long be set according to warn_c90_c99_compat.
gcc/c-family/
	* c-opts.c (sanitize_cpp_opts): Make warn_long_long be set according
	to warn_c90_c99_compat.
	* c.opt (Wc90-c99-compat, Wdeclaration-after-statement): Initialize
	to -1.
gcc/c/
	* c-decl.c (warn_variable_length_array): Pass OPT_Wvla unconditionally
	to pedwarn_c90.
	* c-errors.c: Include "opts.h".
	(pedwarn_c90): Rewrite to handle -Wno-c90-c99-compat better.
	* c-parser.c (disable_extension_diagnostics): Handle negative value
	of warn_c90_c99_compat, too.
	(restore_extension_diagnostics): Likewise.
	(c_parser_compound_statement_nostart): Pass
	OPT_Wdeclaration_after_statement unconditionally to pedwarn_c90.
gcc/testsuite/
	* gcc.dg/Wc90-c99-compat-4.c: Remove all dg-warnings.
	* gcc.dg/Wc90-c99-compat-5.c: Remove all dg-errors.
	* gcc.dg/Wc90-c99-compat-7.c: New test.
	* gcc.dg/Wc90-c99-compat-8.c: New test.
	* gcc.dg/Wdeclaration-after-statement-4.c: New test.
libcpp/
	* charset.c (_cpp_valid_ucn): Warn only if -Wc90-c99-compat.
	* lex.c (_cpp_lex_direct): Likewise.
	* macro.c (replace_args): Likewise.
	(parse_params): Likewise.
	* include/cpplib.h (cpp_options): Change cpp_warn_c90_c99_compat
	to char.

From-SVN: r214131
2014-08-19 05:34:31 +00:00
Marek Polacek f3bede7188 re PR c/51849 (-Wc99-compat would be considered useful)
PR c/51849
gcc/
	* gcc/doc/invoke.texi: Document -Wc90-c99-compat.
gcc/c-family/
	* c-opts.c (sanitize_cpp_opts): Pass warn_c90_c99_compat to libcpp.
	* c.opt (Wc90-c99-compat): Add option.
gcc/c/
	* c-decl.c (build_array_declarator): Remove check for !flag_isoc99.
	Call pedwarn_c90 instead of pedwarn.
	(check_bitfield_type_and_width): Likewise.
	(declspecs_add_qual): Likewise.
	(declspecs_add_type): Likewise.
	(warn_variable_length_array): Unify function for -pedantic and -Wvla.
	Adjust to only call pedwarn_c90.
	(grokdeclarator): Remove pedantic && !flag_isoc99 check.  Call
	pedwarn_c90 instead of pedwarn.
	* c-errors.c (pedwarn_c90): Handle -Wc90-c99-compat.
	* c-parser.c (disable_extension_diagnostics): Handle
	warn_c90_c99_compat.
	(restore_extension_diagnostics): Likewise.
	(c_parser_enum_specifier): Remove check for !flag_isoc99.  Call
	pedwarn_c90 instead of pedwarn.
	(c_parser_initelt): Likewise.
	(c_parser_postfix_expression): Likewise.
	(c_parser_postfix_expression_after_paren_type): Likewise.
	(c_parser_compound_statement_nostart): Remove check for !flag_isoc99.
	* c-tree.h: Fix formatting.
	* c-typeck.c (build_array_ref): Remove check for !flag_isoc99.  Call
	pedwarn_c90 instead of pedwarn.
gcc/testsuite/
	* gcc.dg/Wc90-c99-compat-1.c: New test.
	* gcc.dg/Wc90-c99-compat-2.c: New test.
	* gcc.dg/Wc90-c99-compat-3.c: New test.
	* gcc.dg/Wc90-c99-compat-4.c: New test.
	* gcc.dg/Wc90-c99-compat-5.c: New test.
	* gcc.dg/Wc90-c99-compat-6.c: New test.
	* gcc.dg/wvla-1.c: Adjust dg-warning.
	* gcc.dg/wvla-2.c: Adjust dg-warning.
	* gcc.dg/wvla-4.c: Adjust dg-warning.
	* gcc.dg/wvla-6.c: Adjust dg-warning.
libcpp/
	* lex.c (_cpp_lex_direct): Warn when -Wc90-c99-compat is in effect.
	* charset.c (_cpp_valid_ucn): Likewise.
	* include/cpplib.h (cpp_options): Add cpp_warn_c90_c99_compat.
	* macro.c (replace_args): Warn when -Wc90-c99-compat is in effect.
	(parse_params): Likewise.

From-SVN: r213786
2014-08-10 06:10:49 +00:00
Marek Polacek cdc94aca13 re PR c/57653 (filename information discarded when using -imacros)
PR c/57653
	* c-opts.c (c_finish_options): If -imacros is in effect, return.

	* c-c++-common/pr57653.c: New test.
	* c-c++-common/pr57653.h: New file.
	* c-c++-common/pr57653-2.c: New test.
	* c-c++-common/pr57653-2.h: New file.

From-SVN: r212972
2014-07-24 09:00:13 +00:00
Jason Merrill da73100b48 c-common.h (enum cxx_dialect): Add cxx1z.
* c-common.h (enum cxx_dialect): Add cxx1z.
	* c.opt (std=c++1z, std=c++17, std=gnu++1z, std=gnu++17): New.
	* c-opts.c (c_common_handle_option, set_std_cxx1z): Handle it.

From-SVN: r212042
2014-06-26 14:15:29 -04:00
Teresa Johnson f8a36c783d c-common.h (get_dump_info): Declare.
2014-06-26  Teresa Johnson  <tejohnson@google.com>

	* c-family/c-common.h (get_dump_info): Declare.
	* c-family/c-gimplify.c (c_genericize): Use saved dump files.
	* c-family/c-opts.c (c_common_parse_file): Begin and end dumps
	once around parsing invocation.
	(get_dump_info): New function.
	* cp/class.c (dump_class_hierarchy): Use saved dump files.
	(dump_vtable): Ditto.
	(dump_vtt): Ditto.

From-SVN: r212041
2014-06-26 17:54:19 +00:00
Jason Merrill 6298491866 Support -Wabi warning about backward compatibility.
gcc/c-family/
	* c.opt (Wabi=, fabi-compat-version): New.
	* c-opts.c (c_common_handle_option): Handle -Wabi=.
	(c_common_post_options): Handle flag_abi_compat_version default.
	Disallow -fabi-compat-version=1.
	* c-common.h (abi_version_crosses): New.
gcc/cp/
	* call.c (convert_arg_to_ellipsis): Use abi_version_crosses.
	* cvt.c (type_promotes_to): Likewise.
	* mangle.c (write_type, write_expression): Likewise.
	(write_name, write_template_arg): Likewise.
	(mangle_decl): Make alias based on flag_abi_compat_version.
	Emit -Wabi warning here.
	(finish_mangling_internal): Not here.  Drop warn parm.
	(finish_mangling_get_identifier, finish_mangling): Adjust.
	(mangle_type_string, mangle_special_for_type): Adjust.
	(mangle_ctor_vtbl_for_type, mangle_thunk): Adjust.
	(mangle_guard_variable, mangle_tls_init_fn): Adjust.
	(mangle_tls_wrapper_fn, mangle_ref_init_variable): Adjust.

From-SVN: r211594
2014-06-12 16:47:21 -04:00
Richard Biener b15458becf c-opts.c (c_common_post_options): For -freestanding...
2014-05-06  Richard Biener  <rguenther@suse.de>

	c-family/
	* c-opts.c (c_common_post_options): For -freestanding,
	-fno-hosted and -fno-builtin disable pattern recognition
	if not enabled explicitely.

From-SVN: r210100
2014-05-06 10:46:18 +00:00
Jakub Jelinek b35e0fa081 re PR debug/60603 (.debug_macinfo/.debug_macro has wrong line numbers for built-in macros)
PR debug/60603
c-family/
	* c-opts.c (c_finish_options): Restore cb_file_change call to
	<built-in>.
fortran/
	* cpp.c (gfc_cpp_init): Restore cb_change_file call to
	<built-in>.
testsuite/
	* gcc.dg/debug/dwarf2/dwarf2-macro2.c: New test.

From-SVN: r208763
2014-03-22 08:18:38 +01:00
Ian Bolton 75b107f594 Don't override -ffp-contract=fast if -funsafe-math-optimizations
From-SVN: r208474
2014-03-11 09:41:20 +00:00
Richard Sandiford 23a5b65a92 Update copyright years in gcc/
From-SVN: r206289
2014-01-02 22:23:26 +00:00
Jason Merrill 1f26ac8748 re PR c++/41090 (Using static label reference in c++ class constructor produces wrong code)
PR c++/41090
	Add -fdeclone-ctor-dtor.
gcc/cp/
	* optimize.c (can_alias_cdtor, populate_clone_array): Split out
	from maybe_clone_body.
	(maybe_thunk_body): New function.
	(maybe_clone_body): Call it.
	* mangle.c (write_mangled_name): Remove code to suppress
	writing of mangled name for cloned constructor or destructor.
	(write_special_name_constructor): Handle decloned constructor.
	(write_special_name_destructor): Handle decloned destructor.
	* method.c (trivial_fn_p): Handle decloning.
	* semantics.c (expand_or_defer_fn_1): Clone after setting linkage.
gcc/c-family/
	* c.opt: Add -fdeclone-ctor-dtor.
	* c-opts.c (c_common_post_options): Default to on iff -Os.
gcc/
	* cgraph.h (struct cgraph_node): Add calls_comdat_local.
	(symtab_comdat_local_p, symtab_in_same_comdat_p): New.
	* cif-code.def: Add USES_COMDAT_LOCAL.
	* symtab.c (verify_symtab_base): Make sure we don't refer to a
	comdat-local symbol from outside its comdat.
	* cgraph.c (verify_cgraph_node): Likewise.
	* cgraphunit.c (mark_functions_to_output): Don't mark comdat-locals.
	* ipa.c (symtab_remove_unreachable_nodes): Likewise.
	(function_and_variable_visibility): Handle comdat-local fns.
	* ipa-cp.c (determine_versionability): Don't clone comdat-locals.
	* ipa-inline-analysis.c (compute_inline_parameters): Update
	calls_comdat_local.
	* ipa-inline-transform.c (inline_call): Likewise.
	(save_inline_function_body): Don't clear DECL_COMDAT_GROUP.
	* ipa-inline.c (can_inline_edge_p): Check calls_comdat_local.
	* lto-cgraph.c (input_overwrite_node): Read calls_comdat_local.
	(lto_output_node): Write it.
	* symtab.c (symtab_dissolve_same_comdat_group_list): Clear
	DECL_COMDAT_GROUP for comdat-locals.
include/
	* demangle.h (enum gnu_v3_ctor_kinds):
	Added literal gnu_v3_unified_ctor.
	(enum gnu_v3_ctor_kinds):
	Added literal gnu_v3_unified_dtor.
libiberty/
	* cp-demangle.c (cplus_demangle_fill_ctor,cplus_demangle_fill_dtor):
	Handle unified ctor/dtor.
	(d_ctor_dtor_name): Handle unified ctor/dtor.

From-SVN: r206182
2013-12-23 12:49:47 -05:00
Basile Starynkevitch b826515a45 c-opts.c: Include plugin.h.
[gcc/c-family]
2013-11-19  Basile Starynkevitch  <basile@starynkevitch.net>

        * c-opts.c: Include plugin.h.
        (cb_file_change): Invoke plugin event PLUGIN_INCLUDE_FILE.

[gcc/]
2013-11-19  Basile Starynkevitch  <basile@starynkevitch.net>

        * plugin.def (PLUGIN_INCLUDE_FILE): New event, invoked in 
        cb_file_change.

From-SVN: r205038
2013-11-19 16:26:52 +00:00
Joseph Myers 6dbe09581a c-opts.c (c_common_post_options): Set -ffp-contract=off in C standards modes.
c-family:
	* c-opts.c (c_common_post_options): Set -ffp-contract=off in C
	standards modes.
	* c-cppbuiltin.c (cpp_iec_559_value): Consider -ffp-contract=fast
	to mean lack of IEEE 754 support.

testsuite:
	* gcc.dg/torture/c99-contract-1.c: New test.

From-SVN: r204460
2013-11-06 16:52:47 +00:00
Tobias Burnus e8ff5196a8 c.opt (-Wdate-time): New option
2013-11-05  Tobias Burnus  <burnus@net-b.de>

gcc/c-family/
        * c.opt (-Wdate-time): New option
        * c-opts.c (sanitize_cpp_opts): Pass on to libcpp.

gcc/
        * doc/invoke.texi (-Wdate-time): Document.

gcc/fortran
        * lang.opt (-Wdate-time): New option
        * cpp.c (gfc_cpp_option_data): Add warn_date_time.
        (gfc_cpp_init_options, gfc_cpp_handle_option,
        gfc_cpp_post_options): Handle it and pass on to libcpp.

gcc/testsuite/
        * g++.dg/warn/wdate-time.C: New.
        * gcc.dg/wdate-time.c: New.
        * gfortran.dg/wdate-time.F90: New.

libcpp/
        * include/cpplib.h (CPP_W_DATE_TIME): Added.
        (cpp_options): Add warn_date_time.
        * init.c (cpp_create_reader): Init it.
        * macro.c (_cpp_builtin_macro_text): Warn when
        __DATE__/__TIME__/__TIMESTAMP__ is used.

From-SVN: r204420
2013-11-05 21:27:22 +01:00
Gabriel Dos Reis 604b2bfcc4 c-common.c (c_common_nodes_and_builtins): Use cxx11 in lieu of cxx0x.
2013-06-22  Gabriel Dos Reis  <gdr@integrable-solutions.net>

	* c-common.c (c_common_nodes_and_builtins): Use cxx11 in lieu of cxx0x.
	* c-cppbuiltin.c (c_cpp_builtins): Likewise.
	* c-opts.c (c_common_post_options): Likewise.

cp/
2013-06-22  Gabriel Dos Reis  <gdr@integrable-solutions.net>

	* call.c (null_ptr_cst_p): Use cxx11 in lieu of cxx0x.
	* class.c (add_implicitly_declared_members): Likewise.
	(check_field_decl): Likewise.
	(finalize_literal_type_property): Likewise.
	(check_bases_and_members): Likewise.
	* decl.c (poplevel): Likewise.
	(case_conversion): Likewise.
	(check_initializer): Likewise.
	(grokfndecl): Likewise.
	(check_static_variable_definition): Likewise.
	(compute_array_index_type): Likewise.
	(grokdeclarator): Likewise.
	(build_enumerator): Likewise.
	* friend.c (make_friend_class): Likewise.
	* lex.c (init_reswords): Likewise.
	* method.c (synthesized_method_walk): Likewise.
	(implicitly_declare_fn): Likewise.
	* parser.c (cp_parser_diagnose_invalid_type_name): Likewise.
	(cp_parser_constant_expression): Likewise.
	(cp_parser_for_init_statement): Likewise.
	(cp_parser_block_declaration): Likewise.
	(cp_parser_type_name): Likewise.
	(cp_parser_enum_specifier): Likewise.
	(cp_parser_enumerator_list): Likewise.
	(cp_parser_member_declaration): Likewise.
	(cp_nth_tokens_can_be_std_attribute_p): Likewise.
	(cp_parser_template_declaration_after_export): Likewise.
	* pt.c (convert_nontype_argument_function): Likewise.
	(convert_nontype_argument): Likewise.
	(convert_template_argument): Likewise.
	(tsubst_copy_and_build): Likewise.
	(build_non_dependent_expr): Likewise.
	* semantics.c (non_const_var_error): Likewise.
	(potential_constant_expression_1): Likewise.
	* tree.c (lvalue_kind): Likewise.
	(build_vec_init_expr): Likewise.
	(cast_valid_in_integral_constant_expression_p): Likewise.
	* typeck.c (build_x_conditional_expr): Likewise.
	* typeck2.c (check_narrowing): Likewise.

From-SVN: r200348
2013-06-23 02:27:03 +00:00
Paolo Carlini 61949153f4 cpplib.h (enum c_lang): Add CLK_GNUCXX1Y and CLK_CXX1Y.
/libcpp
2013-04-24  Paolo Carlini  <paolo.carlini@oracle.com>

	* include/cpplib.h (enum c_lang): Add CLK_GNUCXX1Y and CLK_CXX1Y.
	* init.c (lang_defaults): Add defaults for the latter.
	(cpp_init_builtins): Define __cplusplus as 201300L for the latter.
	* lex.c (_cpp_lex_direct): Update.

/gcc/c-family
2013-04-24  Paolo Carlini  <paolo.carlini@oracle.com>

	* c-opts.c (set_std_cxx11): Use CLK_CXX1Y and CLK_GNUCXX1Y.

/gcc/testsuite
2013-04-24  Paolo Carlini  <paolo.carlini@oracle.com>

	* g++.dg/cpp1y/cplusplus.C: New.

From-SVN: r198261
2013-04-24 19:33:54 +00:00
Jakub Jelinek f6007d99f8 re PR pch/54117 (FAIL: ./decl-3.h -O0 -g (internal compiler error))
PR pch/54117
	* c-opts.c (c_common_post_options): If debug info is enabled
	and non-dwarf*, refuse to load PCH files and when writing PCH
	file warn.

	* lib/dg-pch.exp (pch-init, pch-finish,
	check_effective_target_pch_supported_debug): New procs.
	(dg-flags-pch): If $pch_unsupported, make tests UNSUPPORTED.
	Likewise if $pch_unsupported_debug and $flags include -g.
	Skip FAILs about missing *.gch file if $pch_unsupported_debug
	and dg-require-effective-target pch_unsupported_debug.
	* g++.dg/pch/pch.exp: Call pch-init and pch-finish.
	* objc.dg/pch/pch.exp: Likewise.
	* gcc.dg/pch/pch.exp: Likewise.
	* gcc.dg/pch/valid-1.c: Add dg-require-effective-target
	pch_unsupported_debug.
	* gcc.dg/pch/valid-1.hs: Likewise.
	* gcc.dg/pch/valid-1b.c: Likewise.
	* gcc.dg/pch/valid-1b.hs: Likewise.

Co-Authored-By: Steven Bosscher <steven@gcc.gnu.org>

From-SVN: r196124
2013-02-18 20:42:56 +01:00
Jason Merrill 5af057d8bd re PR target/54908 (misc regressions on emutls targets remain from dynamic initialization of non-function-local TLS variables)
PR target/54908
c-family/
	* c.opt (-fextern-tls-init): New.
	* c-opts.c (c_common_post_options): Handle it.
cp/
	* decl2.c (get_local_tls_init_fn): New.
	(get_tls_init_fn): Handle flag_extern_tls_init.  Don't bother
	with aliases for internal variables.  Don't use weakrefs if
	the variable needs destruction.
	(generate_tls_wrapper): Mark the wrapper as const if no
	initialization is needed.
	(handle_tls_init): Don't require aliases.

From-SVN: r195310
2013-01-19 00:25:25 -05:00
Richard Sandiford d1e082c2c2 Update copyright years in gcc/
From-SVN: r195098
2013-01-10 20:38:27 +00:00
Simon Baldwin 5dc99c4678 cpplib.h (struct cpp_options): Add canonical_system_headers.
* include/cpplib.h (struct cpp_options): Add canonical_system_headers.
    * files.c (find_file_in_dir): Call maybe_shorter_path() only if
    canonical_system_headers is set.
    * init.c (cpp_create_reader): Initialize canonical_system_headers.
    * configure.ac: Add new --enable-canonical-system-headers.
    * configure: Regenerate.
    * config.in: Regenerate.

    * doc/cppopts.texi: Document -f[no-]canonical-system-headers.
    * doc/install.texi: Document --enable-canonical-system-headers.

    * c.opt: Add f[no-]canonical-system-headers.
    * c-opts.c (c_common_handle_option): Handle
    OPT_fcanonical_system_headers.

From-SVN: r193569
2012-11-16 17:14:05 +00:00
Ed Smith-Rowland a4a0016d60 Implement a flag -fext-numeric-literals that allows control of whether GNU...
Implement a flag -fext-numeric-literals that allows control of whether GNU
numeric suffix extensions are parsed or passed to C++ as user-defined literals.

From-SVN: r193382
2012-11-10 00:08:49 +00:00
Manuel López-Ibáñez 7332899a42 re PR c/53063 (encode group options in the .opt files)
gcc/
2012-11-07  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR c/53063
	* doc/invoke.texi (Wformat): Update.
c-family/
2012-11-07  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR c/53063
	* c.opt (Wformat): Make it Alias Wformat=1.
	(Wformat-contains-nul,Wformat-extra-args,Wformat-nonliteral,
	Wformat-security,Wformat-y2k,Wformat-zero-length): Use
	LangEnabledBy.
	(Wformat=): RejectNegative. Use LangEnabledBy.
	(Wnonnull): Use LangEnabledBy.
	* c-opts.c (c_common_handle_option): Do not handle Wformat here.
	* c-format.c (set_Wformat): Delete.
	(decode_format_attr): Replace OPT_Wformat with OPT_Wformat_.
        (maybe_read_dollar_number):  Likewise.
        (avoid_dollar_number):  Likewise.
        (finish_dollar_format_checking):  Likewise.
        (check_format_info):  Likewise.
        (check_format_info_main):  Likewise.
        (check_format_types):  Likewise.
        (format_type_warning):  Likewise.
        * c-common.c (int):  Likewise.
        (check_function_sentinel):  Likewise.
        * c-common.h (warn_format,set_Wformat): Do not declare here.
testsuite/
2012-11-07  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR c/53063
	* gcc.dg/warn-nsstring.c: Use -Wformat explicitly.

From-SVN: r193304
2012-11-07 18:27:14 +00:00
Manuel López-Ibáñez 34a180a642 re PR c/53063 (encode group options in the .opt files)
c-family/
2012-11-07  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR c/53063
	* c.opt(Warray-bounds,Wdelete-non-virtual-dtor,Wenum-compare,
	Wmain,Woverlength-strings, Wunknown-pragmas,Wunused-macros):
	Use LangEnabledBy.
	(Wswitch,Wswitch-default,Wswitch-enum): Likewise. Move here from
	common.opt.
	(Wvariadic-macros): Init(1).
	* c-opts.c (c_common_handle_option): Do not handle them
	explicitly.
	(c_common_post_options): Likewise.
	(sanitize_cpp_opts): warn_unused_macros is now
	cpp_warn_unused_macros.
	(push_command_line_include): Likewise.
	* c-common.c (warn_unknown_pragmas): Do not define.
	* c-common.h (warn_unknown_pragmas): Do not declare.
gcc/
2012-11-07  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR c/53063
	* common.opt (Wswitch,Wswitch-default,Wswitch-enum): Move to c.opt.
fortran/
2012-11-07  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR c/53063
	* options.c (set_Wall): Do not set warn_switch here.

From-SVN: r193302
2012-11-07 17:54:11 +00:00
Joseph Myers 1efcb8c6f6 gcc:
* config.gcc (*-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu |
	*-*-knetbsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu): Use
	glibc-c.o in c_target_objs and cxx_target_objs.  Use t-glibc in
	tmake_file.  Set target_has_targetcm.
	(tilegx-*-linux*, tilepro-*-linux*): Append to c_target_objs and
	cxx_target_objs rather than overriding previous value.
	* config/glibc-c.c, config/t-glibc: New.
	* doc/tm.texi.in (TARGET_C_PREINCLUDE): New @hook.
	* doc/tm.texi: Regenerate.
	* hooks.c (hook_constcharptr_void_null): New.
	* hooks.h (hook_constcharptr_void_null): Declare.

gcc/c-family:
	* c-common.h (pch_cpp_save_state): Declare.
	* c-target.def (c_preinclude): New hook.
	* c-opts.c (done_preinclude): New.
	(push_command_line_include): Handle default preincluded header.
	(cb_file_change): Call pch_cpp_save_state when calling
	push_command_line_include.
	* c-pch.c (pch_ready_to_save_cpp_state, pch_cpp_state_saved)
	(pch_cpp_save_state): New.
	(pch_init): Call pch_cpp_save_state conditionally, instead of
	calling cpp_save_state.

gcc/testsuite:
	* gcc.dg/c99-predef-1.c: New test.
	* gcc.dg/cpp/cmdlne-dU-1.c, gcc.dg/cpp/cmdlne-dU-2.c,
	gcc.dg/cpp/cmdlne-dU-3.c, gcc.dg/cpp/cmdlne-dU-4.c,
	gcc.dg/cpp/cmdlne-dU-5.c, gcc.dg/cpp/cmdlne-dU-6.c,
	gcc.dg/cpp/cmdlne-dU-7.c, gcc.dg/cpp/cmdlne-dU-8.c,
	gcc.dg/cpp/cmdlne-dU-9.c, gcc.dg/cpp/cmdlne-dU-10.c,
	gcc.dg/cpp/cmdlne-dU-11.c, gcc.dg/cpp/cmdlne-dU-12.c,
	gcc.dg/cpp/cmdlne-dU-13.c, gcc.dg/cpp/cmdlne-dU-14.c,
	gcc.dg/cpp/cmdlne-dU-15.c, gcc.dg/cpp/cmdlne-dU-16.c,
	gcc.dg/cpp/cmdlne-dU-17.c, gcc.dg/cpp/cmdlne-dU-18.c,
	gcc.dg/cpp/cmdlne-dU-19.c, gcc.dg/cpp/cmdlne-dU-20.c,
	gcc.dg/cpp/cmdlne-dU-21.c, gcc.dg/cpp/cmdlne-dU-22.c,
	gcc.dg/cpp/mi5.c, gcc.dg/cpp/multiline.c: Add -nostdinc to
	dg-options.

libcpp:
	* files.c (struct _cpp_file): Add implicit_preinclude.
	(pch_open_file): Allow a previously opened implicitly included
	file.
	(_cpp_find_file): Add implicit_preinclude argument.  Free file and
	do not call open_file_failed if implicit_preinclude.  Store
	implicit_preinclude value.
	(_cpp_stack_include, _cpp_fake_include, _cpp_compare_file_date):
	Update calls to _cpp_find_file.
	(_cpp_stack_include): Handle IT_DEFAULT.
	(cpp_push_default_include): New.
	* include/cpplib.h (cpp_push_default_include): Declare.
	* init.c (cpp_read_main_file): Update call to _cpp_find_file.
	* internal.h (enum include_type): Add IT_DEFAULT.
	(_cpp_find_file): Update prototype.

From-SVN: r192715
2012-10-23 15:55:55 +01:00
Manuel López-Ibáñez 4a0ae68e1c re PR c/53063 (encode group options in the .opt files)
2012-10-20  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR c/53063
	PR c/40989
c-family/
	* c.opt (Waddress,Wchar-subscripts,Wsign-conversion,Wimplicit,
	Wimplicit-function-declaration,Wimplicit-int,Wsizeof-pointer-memaccess,
	Wnarrowing,Wparentheses,Wpointer-sign,Wreturn-type,Wsequence-point,
	Wsign-compare,Wuninitialized,Wmaybe-uninitialized,Wunused,
	Wvolatile-register-var): Add LangEnabledBy or EnabledBy.
	* c-opts.c (c_common_handle_option): Remove explicit handling from
	here.
	(c_common_post_options): Likewise.
gcc/
	* opts.c (finish_options): Remove explicit handling from here.

From-SVN: r192635
2012-10-20 14:17:08 +00:00
Manuel López-Ibáñez 65d4f2cd2a re PR c/53063 (encode group options in the .opt files)
2012-10-16  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR c/53063
	PR c/40989
gcc/
	* optc-gen.awk: Handle new form of LangEnabledBy.
	* opts.c (set_Wstrict_aliasing): Declare here. Make static.
	* common.opt (Wstrict-aliasing=,Wstrict-overflow=): Do not use Init.
	* doc/options.texi (LangEnabledBy): Document new form.
	* flags.h (set_Wstrict_aliasing): Do not declare.
c-family/
	* c.opt (Wstrict-aliasing=,Wstrict-overflow=): Use LangEnabledBy.
	* c-opts.c (c_common_handle_option): Do not set them here. Add
	comment.
	(c_common_post_options): Likewise.
testsuite/
	* gcc.dg/Wstrict-overflow-24.c: New.

From-SVN: r192502
2012-10-16 15:31:46 +00:00
Jakub Jelinek 1a4049e7c5 invoke.texi (-Wsizeof-pointer-memaccess): Document.
* doc/invoke.texi (-Wsizeof-pointer-memaccess): Document.
c/
	* c-tree.h (c_last_sizeof_arg): Declare.
	* c-parser.c (struct c_tree_loc_pair): New type.
	(c_parser_expr_list): Add sizeof_arg argument.  Fill it in if
	non-NULL.
	(c_parser_attributes, c_parser_objc_keywordexpr): Adjust callers.
	(c_parser_postfix_expression_after_primary): Likewise.  Call
	sizeof_pointer_memaccess_warning if needed.
	(sizeof_ptr_memacc_comptypes): New function.
	* c-typeck.c (c_last_sizeof_arg): New global variable.
	(c_expr_sizeof_expr, c_expr_sizeof_type): Initialize it.
cp/
	* cp-tree.def (SIZEOF_EXPR): Move to c-common.def.
c-family/
	* c-common.c (sizeof_pointer_memaccess_warning): New function.
	* c.opt (-Wsizeof-pointer-memaccess): Add new option.
	* c-opts.c (c_common_handle_option): Enable it for -Wall.
	* c-common.h (sizeof_pointer_memaccess_warning): Add prototype.
	* c-common.def (SIZEOF_EXPR): Moved here from cp-tree.def.
fortran/
	* array.c (gfc_match_array_ref): Fix up memset arguments.
testsuite/
	* gcc.dg/torture/Wsizeof-pointer-memaccess1.c: New test.

From-SVN: r190467
2012-08-17 09:17:56 +02:00
Steven Bosscher 8ca92d04e1 c-common.h (c_common_print_pch_checksum): Remove.
c-family/
	* c-common.h (c_common_print_pch_checksum): Remove.
	* c-pch.c: Do not include output.h.
	(CHECK_NO_ASM_OUT_DURING_PCH): Define and add FIXME.
	(asm_out_file): Define iff CHECK_NO_ASM_OUT_DURING_PCH isdefined.
	(asm_file_startpos): Define iff CHECK_NO_ASM_OUT_DURING_PCH is defined.
	(struct c_pch_header): Remove.
	(get_ident): Update gpch version.
	(pch_init): Do not print executable_checksum to asm_out_file.
	Do not fail if there is no asm_out_file to read back from.  Set
	asm_file_startpos only if CHECK_NO_ASM_OUT_DURING_PCH is defined.
	(c_common_write_pch): Verify that nothing was written to asm_out_file
	since pch_init was called.  Do not write a c_pch_header, and do not
	copy from asm_out_file to the PCH.
	(c_common_read_pch): Do not read a c_pch_header, and do not restore
	the content of asm_out_file from the PCH.
	(c_common_print_pch_checksum): Remove.
	* c-opts.c (c_common_init): Print out executable_checksum directly.

testsuite/
	* testsuite/gcc.dg/pch/ident-1.c: New test.
	* testsuite/gcc.dg/pch/ident-1.hs: Header file for new test.

From-SVN: r188856
2012-06-21 16:53:45 +00:00
Manuel López-Ibáñez 4f7f7aca35 c.opt (Wmissing-braces): Use LangEnabledBy(C ObjC,Wall).
2012-05-29  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	* c.opt (Wmissing-braces): Use LangEnabledBy(C ObjC,Wall).
	* c-opts.c (c_common_handle_option): Remove code handling
	warn_missing_braces.

From-SVN: r187948
2012-05-29 10:09:51 +00:00
Paolo Carlini 4a792f9b95 re PR c++/25137 (Warning "missing braces around initializer" causing problems with tr1::array)
/c-family
2012-05-28  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/25137
	* c-opts.c (c_common_handle_option): For C++ -Wall doesn't enable
	-Wmissing_braces.

2012-05-28  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/25137
	* doc/invoke.texi: Document -Wmissing-braces not enabled by -Wall
	for C++.

/testsuite
2012-05-28  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/25137
	* g++.dg/warn/Wbraces3.C: New.
	* g++.dg/warn/Wbraces4.C: Likewise.

From-SVN: r187937
2012-05-28 17:42:29 +00:00
Manuel López-Ibáñez 9b095bf15c c.opt (--pedantic-errors,-pedantic-errors): Do not handle here.
2012-05-17  Manuel López-Ibáñez  <manu@gcc.gnu.org>

c-family/
	* c.opt (--pedantic-errors,-pedantic-errors): Do not handle here.
	* c-opts.c (c_common_handle_option): Do not handle explicitly
	Wreturn-type, Wwrite-strings, warn_ecpp, and -pedantic-errors.
gcc/
	* opts.c (common_handle_option): -pedantic-errors enables -Wpedantic.
	(enable_warning_as_error): Do not special case Wuninitialized.
	* optc-gen.awk: Add sanity checks.

From-SVN: r187628
2012-05-17 11:50:37 +00:00
Manuel López-Ibáñez f2bc201f53 re PR c/53063 (encode group options in the .opt files)
2012-05-14  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR 53063
c-family/
	* c.opt (Wc++0X-compat,Wdelete-non-virtual-dtor,Wjump-misses-init,
	Wreorder): Use LangEnabledBy.
	* c-opts.c (c_common_handle_option): Do not enable them
	explicitly. Call lang-specific generated functions.
	(c_common_post_options): Do not set them here.
gcc/
	* doc/options.texi: (LangEnabledBy): Document it.
	* optc-gen.awk: Handle LangEnabledBy.
	* opth-gen.awk: Generate declaration for lang-specific functions.
	* opt-read.awk: Record lang numbers.
	* opt-functions.awk (flag_set_p): Ignore the arguments of flags.
	(lang_sanitized_name): New.
ada/
	* gcc-interface/misc.c: Include opts.h and options.h before tm.h.
	(gnat_handle_option): Call lang-specific generated function.
fortran/
	* options.c (gfc_handle_option): Call lang-specific generated function.

From-SVN: r187462
2012-05-14 13:30:32 +00:00
Manuel López-Ibáñez 9574478218 c.opt (Wclobbered,Wempty-body,Wignored-qualifiers, [...]): Use EnabledBy.
2012-05-13  Manuel López-Ibáñez  <manu@gcc.gnu.org>

c-family/
	* c.opt (Wclobbered,Wempty-body,Wignored-qualifiers,
	Wmissing-field-initializers,Wmissing-parameter-type,
	Wold-style-declaration,Woverride-init): Use EnabledBy.
	* c-opts.c (c_common_post_options): Do not set here explicitly.
gcc/
	* common.opt (Wtype-limits): Use EnabledBy.

From-SVN: r187441
2012-05-13 17:38:41 +00:00
Manuel López-Ibáñez 7d5a5747fc re PR c/53063 (encode group options in the .opt files)
2012-05-11  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR 53063
gcc/
	* doc/options.texi (EnabledBy): Document
	* opts.c: Include opts.h and options.h before tm.h.
	(finish_options): Do not handle some sub-options here...
	(common_handle_option): ... instead call common_handle_option_auto here.
	* optc-gen.awk: Handle EnabledBy.
	* opth-gen.awk: Declare common_handle_option_auto.
	* common.opt (Wuninitialized): Use EnabledBy. Delete Init.
	(Wmaybe-uninitialized): Likewise.
        (Wunused-but-set-variable): Likewise.
        (Wunused-function): Likewise.
        (Wunused-label): Likewise.
        (Wunused-value): Likewise.
        (Wunused-variable): Likewise.
        * opt-read.awk: Create opt_numbers array.
ada/
	* gcc-interface/misc.c (gnat_parse_file): Move before ...
	(gnat_handle_option): ... this. Use handle_generated_option.
c-family/
	* c-opts.c (c_common_handle_option): Use handle_generated_option
	to enable sub-options.
fortran/
	* options.c: Include diagnostics.h instead of
	diagnostics-core.h.
	(set_Wall): Do not see warn_unused here.
	(gfc_handle_option): Set it here using handle_generated_option.

From-SVN: r187403
2012-05-11 12:23:50 +00:00
Ollie Wild 7f5f5f98c5 Add new option, -Wliteral-suffix.
This option, which is enabled by default, causes the preprocessor to warn
when a string or character literal is followed by a ud-suffix which does
not begin with an underscore.  According to [lex.ext]p10, this is
ill-formed.

Also modifies the preprocessor to treat such ill-formed suffixes as separate
preprocessing tokens.  This is consistent with the Clang front end (see
http://llvm.org/viewvc/llvm-project?view=rev&revision=152287), and enables
backwards compatibility with code that uses formatting macros from
<inttypes.h>, as in the following code block:

  int main() {
    int64_t i64 = 123;
    printf("My int64: %"PRId64"\n", i64);
  }

Google ref b/6377711.

2012-04-27   Ollie Wild  <aaw@google.com>

	PR c++/52538
	* gcc/c-family/c-common.c: Add CPP_W_LITERAL_SUFFIX mapping.
	* gcc/c-family/c-opts.c (c_common_handle_option): Handle
	OPT_Wliteral_suffix.
	* gcc/c-family/c.opt: Add Wliteral-suffix.
	* gcc/doc/invoke.texi (Wliteral-suffix): Document new option.
	* gcc/testsuite/g++.dg/cpp0x/Wliteral-suffix.c: New test.
	* libcpp/include/cpplib.h (struct cpp_options): Add new field,
	warn_literal_suffix.
	(CPP_W_LITERAL_SUFFIX): New enum.
	* libcpp/init.c (cpp_create_reader): Default initialization of
	warn_literal_suffix.
	* libcpp/lex.c (lex_raw_string): Treat user-defined literals which
	don't begin with '_' as separate tokens and produce a warning.
	(lex_string): Ditto.

From-SVN: r186909
2012-04-27 14:29:32 +00:00
Manuel López-Ibáñez c1771a200a re PR c/44774 (-Werror=edantic)
2012-04-22  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR c/44774
gcc/
	* doc/invoke.texi (pedantic): Rename to Wpedantic.
	* common.opt (Wpedantic): New.
	(pedantic): Alias Wpedantic.
	* diagnostic.c (warning_at): Likewise.
	* c-decl.c (diagnose_mismatched_decls): Likewise.
	(build_array_declarator): Likewise.
	(mark_forward_parm_decls):
	(check_bitfield_type_and_width): Likewise.
	(grokdeclarator): Likewise.
	(grokfield): Likewise.
	(finish_struct): Likewise.
	(build_enumerator): Likewise.
	(store_parm_decls_oldstyle): Likewise.
	(declspecs_add_qual): Likewise.
	(declspecs_add_type): Likewise.
	(finish_declspecs): Likewise.
	* c-typeck.c (composite_type): Likewise.
	(comp_target_types): Likewise.
	(build_array_ref): Likewise.
	(pointer_diff): Likewise.
	(build_unary_op): Likewise.
	(build_conditional_expr): Likewise.
	(build_c_cast): Likewise.
	(convert_for_assignment): Likewise.
	(maybe_warn_string_init): Likewise.
	(digest_init): Likewise.
	(pop_init_level): Likewise.
	(set_init_index): Likewise.
	(c_finish_goto_label): Likewise.
	(c_finish_return): Likewise.
	(do_case): Likewise.
	(build_binary_op): Likewise.
	* c-parser.c (static): Likewise.
	(c_parser_external_declaration): Likewise.
	(c_parser_declaration_or_fndef): Likewise.
	(c_parser_static_assert_declaration_no_se): Likewise.
	(c_parser_enum_specifier): Likewise.
	(c_parser_struct_or_union_specifier): Likewise.
	(c_parser_struct_declaration): Likewise.
	(c_parser_alignas_specifier): Likewise.
	(c_parser_braced_init): Likewise.
	(c_parser_initelt): Likewise.
	(c_parser_compound_statement_nostart): Likewise.
	(c_parser_conditional_expression): Likewise.
	(c_parser_alignof_expression): Likewise.
	(c_parser_postfix_expression): Likewise.
	(c_parser_postfix_expression_after_paren_): Likewise.
	(c_parser_objc_class_instance_variables): Likewise.
	(c_parser_objc_method_definition): Likewise.
	(c_parser_objc_methodprotolist): Likewise.

c-family/
	* c.opt (Wpedantic): New.
	(pedantic): Alias Wpedantic.
	* c-opts.c (c_common_handle_option): Replace -pedantic with -Wpedantic.
	(c_common_post_options): Likewise.
	(sanitize_cpp_opts): Likewise.
	* c-lex.c (interpret_float): Likewise.
	* c-format.c (check_format_types): Likewise.
	* c-common.c (pointer_int_sum): Likewise.
	(c_sizeof_or_alignof_type): Likewise.
	(c_add_case_label): Likewise.
	(c_do_switch_warnings): Likewise.
	* c-pragma.c (handle_pragma_float_const_decimal64): Likewise.
cp/
	* typeck.c (composite_pointer_type): Likewise.
	(cxx_sizeof_or_alignof_type): Likewise.
	(cp_build_array_ref): Likewise.
	(cp_build_function_call_vec): Likewise.
	(cp_build_addr_expr_1): Likewise.
	(convert_member_func_to_ptr): Likewise.
	* decl.c (check_tag_decl): Likewise.
	(check_static_variable_definition): Likewise.
	(compute_array_index_type): Likewise.
	(create_array_type_for_decl): Likewise.
	(grokdeclarator): Likewise.
	(grok_op_properties): Likewise.
	* error.c (maybe_warn_cpp0x): Likewise.
	* pt.c (maybe_process_partial_specialization): Likewise.
	(convert_template_argument): Likewise.
	(do_decl_instantiation): Likewise.
	(do_type_instantiation): Likewise.
	* parser.c (cp_parser_primary_expression): Likewise.
	(cp_parser_postfix_expression): Likewise.
	(cp_parser_unary_expression): Likewise.
	(cp_parser_question_colon_clause): Likewise.
	(cp_parser_lambda_introducer): Likewise.
	(cp_parser_lambda_declarator_opt): Likewise.
	(cp_parser_compound_statement): Likewise.
	(cp_parser_jump_statement): Likewise.
	(cp_parser_declaration_seq_opt): Likewise.
	(cp_parser_enum_specifier): Likewise.
	(cp_parser_enumerator_list): Likewise.
	(cp_parser_initializer_list): Likewise.
	(cp_parser_member_declaration): Likewise.
	* call.c (build_conditional_expr_1): Likewise.
	* friend.c (make_friend_class): Likewise.
	* name-lookup.c (pushdecl_maybe_friend_1): Likewise.

From-SVN: r186681
2012-04-22 19:17:47 +00:00
Jason Merrill 552b8185be c-common.h (enum cxx_dialect): Add cxx1y.
* c-common.h (enum cxx_dialect): Add cxx1y.
	* c-common.c (c_common_nodes_and_builtins): Use >= for cxx_dialect
	test.
	* c-cppbuiltin.c (c_cpp_builtins): Likewise.
	* c-opts.c (c_common_post_options): Likewise.
	(set_std_cxx1y): New.
	(c_common_handle_option): Call it.
	* c.opt (-std=c++1y, -std=gnu++1y): New flags.
cp/
	* lex.c (init_reswords): Use >= for cxx_dialect test.
	* parser.c (cp_parser_exception_specification_opt): Likewise.
testsuite/
	* lib/target-supports.exp: Add { target c++1y }.

From-SVN: r185596
2012-03-21 01:09:41 -04:00