Commit Graph

52 Commits

Author SHA1 Message Date
Jason Merrill 2aaeea194b expr.c (cpp_classify_number): Hex floats are new in C++1z.
* libcpp/expr.c (cpp_classify_number): Hex floats are new in C++1z.

	* libcpp/init.c (lang_defaults): Likewise.
	* gcc/c-family/c-cppbuiltin.c (c_cpp_builtins): Set __cpp_hex_float.

From-SVN: r234213
2016-03-15 08:08:31 -04:00
Jakub Jelinek 818ab71a41 Update copyright years.
From-SVN: r232055
2016-01-04 15:30:50 +01:00
Edward Smith-Rowland fe95b0366a Implement N4197 - Adding u8 character literals
libcpp:

2015-06-30  Edward Smith-Rowland  <3dw4rd@verizon.net>

	Implement N4197 - Adding u8 character literals
	* include/cpplib.h (UTF8CHAR, UTF8CHAR_USERDEF): New cpp tokens;
	(struct cpp_options): Add utf8_char_literals.
	* init.c (struct lang_flags): Add utf8_char_literals;
	(struct lang_flags lang_defaults): Add column for utf8_char_literals.
	* macro.c (stringify_arg()): Treat CPP_UTF8CHAR token; 
	* expr.c (cpp_userdef_char_remove_type(), cpp_userdef_char_add_type()):
	Treat CPP_UTF8CHAR_USERDEF, CPP_UTF8CHAR tokens;
	(cpp_userdef_char_p()): Treat CPP_UTF8CHAR_USERDEF token;
	(eval_token(), _cpp_parse_expr()): Treat CPP_UTF8CHAR token.
	* lex.c (lex_string(), _cpp_lex_direct()): Include CPP_UTF8CHAR tokens.
	* charset.c (converter_for_type(), cpp_interpret_charconst()):
	Treat CPP_UTF8CHAR token.


gcc/c-family:

2015-06-30  Edward Smith-Rowland  <3dw4rd@verizon.net>

	Implement N4197 - Adding u8 character literals
	* c-family/c-ada-spec.c (print_ada_macros()): Treat CPP_UTF8CHAR
	like CPP_CHAR.
	* c-family/c-common.c (c_parse_error()): print CPP_UTF8CHAR
	and CPP_UTF8CHAR_USERDEF tokens.
	* c-family/c-lex.c (c_lex_with_flags()): Treat CPP_UTF8CHAR_USERDEF
	and CPP_UTF8CHAR tokens; (lex_charconst()): Treat CPP_UTF8CHAR token.


gcc/cp:

2015-06-30  Edward Smith-Rowland  <3dw4rd@verizon.net>

	Implement N4197 - Adding u8 character literals
	* parser.c (cp_parser_primary_expression()): Treat CPP_UTF8CHAR
	and CPP_UTF8CHAR_USERDEF tokens;
	(cp_parser_parenthesized_expression_list()): Treat CPP_UTF8CHAR token.


gcc/testsuite:

2015-06-30  Edward Smith-Rowland  <3dw4rd@verizon.net>

	Implement N4197 - Adding u8 character literals
	* g++.dg/cpp1z/utf8.C: New.
	* g++.dg/cpp1z/utf8-neg.C: New.
	* g++.dg/cpp1z/udlit-utf8char.C: New.

From-SVN: r225185
2015-06-30 12:58:48 +00:00
Jakub Jelinek 6e6cb47146 expr.c (cpp_classify_number): Add N_() around ?...
* expr.c (cpp_classify_number): Add N_() around ?: string
	literals used in cpp_error_with_line call as format string.

From-SVN: r219759
2015-01-16 18:40:15 +01:00
Jakub Jelinek 5624e564d2 Update copyright years.
From-SVN: r219188
2015-01-05 13:33:28 +01:00
Jakub Jelinek 1f8d3e84ee re PR preprocessor/63831 (r217292 causes segfaults with -MM)
PR preprocessor/63831
	* c-cppbuiltin.c (c_cpp_builtins): Don't define __has_attribute
	and __has_cpp_attribute here.
	* c-ppoutput.c (init_pp_output): Set cb->has_attribute to
	c_common_has_attribute.
	* c-common.h (c_common_has_attribute): New prototype.
	* c-lex.c (init_c_lex): Set cb->has_attribute to
	c_common_has_attribute instead of cb_has_attribute.
	(get_token_no_padding): New function.
	(cb_has_attribute): Renamed to ...
	(c_common_has_attribute): ... this.  No longer static.  Use
	get_token_no_padding, require ()s, don't build TREE_LIST
	unnecessarily, fix up formatting, adjust diagnostics, call
	init_attributes.

	* directives.c (lex_macro_node): Remove __has_attribute__ handling.
	* internal.h (struct spec_node): Remove n__has_attribute__ field.
	(struct lexer_state): Remove in__has_attribute__ field.
	* macro.c (_cpp_builtin_macro_text): Handle BT_HAS_ATTRIBUTE.
	* identifiers.c (_cpp_init_hashtable): Remove __has_attribute__
	handling.
	* init.c (builtin_array): Add __has_attribute and __has_cpp_attribute.
	(cpp_init_special_builtins): Don't initialize __has_attribute
	or __has_cpp_attribute if CLK_ASM or pfile->cb.has_attribute is NULL.
	* traditional.c (enum ls): Remove ls_has_attribute,
	ls_has_attribute_close.
	(_cpp_scan_out_logical_line): Remove __has_attribute__ handling.
	* include/cpplib.h (enum cpp_builtin_type): Add BT_HAS_ATTRIBUTE.
	* pch.c (cpp_read_state): Remove __has_attribute__ handling.
	* expr.c (eval_token): Likewise.
	(parse_has_attribute): Removed.

	* c-c++-common/cpp/pr63831-1.c: New test.
	* c-c++-common/cpp/pr63831-2.c: New test.

From-SVN: r218948
2014-12-19 13:20:58 +01:00
Edward Smith-Rowland 42fd12b1e7 cpplib.h (cpp_callbacks): Add has_attribute.
libcpp:

2014-11-10  Edward Smith-Rowland  <3dw4rd@verizon.net>

	* include/cpplib.h (cpp_callbacks): Add has_attribute.
	* internal.h (lexer_state): Add in__has_attribute__.
	* directives.c (lex_macro_node): Prevent use of __has_attribute__
	as a macro.
	* expr.c (parse_has_attribute): New function; (eval_token): Look for
	__has_attribute__ and route to parse_has_attribute.
	* identifiers.c (_cpp_init_hashtable): Initialize n__has_attribute__.
	* pch.c (cpp_read_state): Initialize n__has_attribute__.
	* traditional.c (enum ls): Add ls_has_attribute, ls_has_attribute_close;
	(_cpp_scan_out_logical_line): Attend to __has_attribute__.


gcc/c-family:

2014-11-10  Edward Smith-Rowland  <3dw4rd@verizon.net>

	* c-cppbuiltin.c (__has_attribute, __has_cpp_attribute): New macros;
	(__cpp_rtti, __cpp_exceptions): New macros for C++98;
	(__cpp_range_based_for, __cpp_initializer_lists,
	__cpp_delegating_constructors, __cpp_nsdmi,
	__cpp_inheriting_constructors, __cpp_ref_qualifiers): New macros
	for C++11; (__cpp_attribute_deprecated): Remove in favor of
	__has_cpp_attribute.
	* c-lex.c (cb_has_attribute): New callback CPP function;
	(init_c_lex): Set has_attribute callback.


gcc/testsuite:

2014-11-10  Edward Smith-Rowland  <3dw4rd@verizon.net>

	* g++.dg/cpp1y/feat-cxx11.C: Test new feature macros for C++98
	and C++11; Test existence of __has_cpp_attribute;  Test C++11
	attributes.
	* g++.dg/cpp1y/feat-cxx11-neg.C: Ditto.
	* g++.dg/cpp1y/feat-cxx14.C: Ditto and test for C++14 attributes.
	* g++.dg/cpp1y/feat-cxx98.C: Test new feature macros for C++98.
	* g++.dg/cpp1y/feat-cxx98-neg.C: Ditto.
	* g++.dg/cpp1y/feat-neg.C: Test that __cpp_rtti, _cpp_exceptions
	will be undefined for -fno-rtti -fno-exceptions.

From-SVN: r217292
2014-11-10 15:53:12 +00:00
Edward Smith-Rowland a15f7cb8b8 Implement SD-6: SG10 Feature Test Recommendations
2014-10-01  Edward Smith-Rowland  <3dw4rd@verizon.net>

	Implement SD-6: SG10 Feature Test Recommendations
	* internal.h (lexer_state, spec_nodes): Add in__has_include__.
	* directives.c: Support __has_include__ builtin.
	* expr.c (parse_has_include): New function to parse __has_include__
	builtin; (eval_token()): Use it.
	* files.c (_cpp_has_header()): New funtion to look for header;
	(open_file_failed()): Not an error to not find a header file for
	__has_include__.
	* identifiers.c (_cpp_init_hashtable()): Add entry for __has_include__.
	* pch.c (cpp_read_state): Lookup __has_include__.
	* traditional.c (enum ls, _cpp_scan_out_logical_line()): Walk through
	__has_include__ statements.

2014-10-01  Edward Smith-Rowland  <3dw4rd@verizon.net>

	Implement SD-6: SG10 Feature Test Recommendations
	* c-cppbuiltin.c (c_cpp_builtins()): Define language feature
	macros and the __has_header macro.

2014-10-01  Edward Smith-Rowland  <3dw4rd@verizon.net>

	Implement SD-6: SG10 Feature Test Recommendations
	* include/bits/basic_string.h: Add __cpp_lib feature test macro.
	* include/bits/stl_algobase.h: Ditto.
	* include/bits/stl_function.h: Ditto.
	* include/bits/unique_ptr.h: Ditto.
	* include/std/chrono: Ditto.
	* include/std/complex: Ditto.
	* include/std/iomanip: Ditto.
	* include/std/shared_mutex: Ditto.
	* include/std/tuple: Ditto.
	* include/std/type_traits: Ditto.
	* include/std/utility: Ditto.
	* testsuite/experimental/feat-cxx14.cc: New.
	* testsuite/experimental/feat-lib-fund.cc: New.
	* testsuite/20_util/declval/requirements/1_neg.cc: Adjust.
	* testsuite/20_util/duration/literals/range.cc: Adjust.
	* testsuite/20_util/duration/requirements/typedefs_neg1.cc: Adjust.
	* testsuite/20_util/duration/requirements/typedefs_neg2.cc: Adjust.
	* testsuite/20_util/duration/requirements/typedefs_neg3.cc: Adjust.
	* testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Adjust.
	* testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Adjust.
	* testsuite/23_containers/array/tuple_interface/get_neg.cc: Adjust.
	* testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc:
	Adjust.

2014-10-01  Edward Smith-Rowland  <3dw4rd@verizon.net>

	Implement SD-6: SG10 Feature Test Recommendations
	* g++.dg/cpp1y/feat-cxx11-neg.C: New.
	* g++.dg/cpp1y/feat-cxx11.C: New.
	* g++.dg/cpp1y/feat-cxx14.C: New.
	* g++.dg/cpp1y/feat-cxx98.C: New.
	* g++.dg/cpp1y/feat-cxx98-neg.C: New.
	* g++.dg/cpp1y/phoobhar.h: New.
	* g++.dg/cpp1y/testinc/phoobhar.h: New.

From-SVN: r215752
2014-10-01 11:49:23 +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
Edward Smith-Rowland 7c05e50c73 PR cpp/23827 - standard C++ should not have hex float preprocessor
libcpp/

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

	PR cpp/23827 - standard C++ should not have hex float preprocessor
	tokens
	* libcpp/init.c (lang_flags): Change CXX98 flag for extended numbers
	from 1 to 0.
	* libcpp/expr.c (cpp_classify_number): Weite error message for improper
	use of hex floating literal.


gcc/testsuite/

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

	PR cpp/23827 - standard C++ should not have hex float preprocessor
	tokens
	* g++.dg/cpp/pr23827_cxx11.C: New.
	* g++.dg/cpp/pr23827_cxx98.C: New.
	* g++.dg/cpp/pr23827_cxx98_neg.C: New.
	* gcc.dg/cpp/pr23827_c90.c: New.
	* gcc.dg/cpp/pr23827_c90_neg.c: New.
	* gcc.dg/cpp/pr23827_c99.c: New.

From-SVN: r214616
2014-08-28 02:38:24 +00: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
Richard Sandiford 35c3d610e3 Update copyright years in libcpp/
From-SVN: r206293
2014-01-02 22:24:45 +00:00
Joseph Myers 3a4efce7c2 re PR preprocessor/55715 (bogus overflow warning for #if A-B when A<0 & B==minimum integer)
PR preprocessor/55715
libcpp:
	* expr.c (num_binary_op): Implement subtraction directly rather
	than with negation and falling through into addition case.

gcc/testsuite:
	* gcc.dg/cpp/expr-overflow-1.c: New test.

From-SVN: r205846
2013-12-10 01:23:37 +00:00
Edward Smith-Rowland 7057e6452b Implement C++14 digit separators.
libcpp:

2013-10-31  Edward Smith-Rowland  <3dw4rd@verizon.net>

        Implement C++14 digit separators.
	* include/cpplib.h (cpp_options): Add digit_separators flag.
	* internal.h (DIGIT_SEP(c)): New macro.
	* expr.c (cpp_classify_number): Check improper placement of digit sep;
	(cpp_interpret_integer): Skip over digit separators.
	* init.c (lang_flags): Add digit_separators flag; (lang_defaults): Add
	digit separator flags per language; (cpp_set_lang): Set
	digit_separators
	* lex.c (lex_number): Add digits separator to allowable characters for
	C++14.


gcc/c-family:

2013-10-31  Edward Smith-Rowland  <3dw4rd@verizon.net>

        Implement C++14 digit separators.
	* c-lex.c (interpret_float): Remove digit separators from scratch string
	before building real literal.


gcc/testsuite:

2013-10-31  Edward Smith-Rowland  <3dw4rd@verizon.net>

        Implement C++14 digit separators.
	* g++.dg/cpp1y/digit-sep.C: New.
	* g++.dg/cpp1y/digit-sep-neg.C: New.
	* g++.dg/cpp1y/digit-sep-cxx11-neg.C: New.


libstdc++-v3:

2013-10-31  Edward Smith-Rowland  <3dw4rd@verizon.net>

        Implement C++14 digit separators.
	* include/include/bits/parse_numbers.h: Change struct _Digit<_Base, '`'>
	to struct _Digit<_Base, '\''>.

From-SVN: r204260
2013-10-31 14:01:23 +00:00
Jakub Jelinek 01187df097 N3472 binary constants
N3472 binary constants
	* include/cpplib.h (struct cpp_options): Fix a typo in user_literals
	field comment.  Add binary_constants field.
	* init.c (struct lang_flags): Add binary_constants field.
	(lang_defaults): Add bin_cst column to the table.
	(cpp_set_lang): Initialize CPP_OPTION (pfile, binary_constants).
	* expr.c (cpp_classify_number): Talk about C++11 instead of C++0x
	in diagnostics.  Accept binary constants if
	CPP_OPTION (pfile, binary_constants) even when pedantic.  Adjust
	pedwarn message.

	* g++.dg/cpp/limits.C: Adjust warning wording.
	* g++.dg/system-binary-constants-1.C: Likewise.
	* g++.dg/cpp1y/system-binary-constants-1.C: New test.

From-SVN: r198380
2013-04-28 23:36:57 +02:00
Richard Sandiford 500f3ed906 Update copyright years in libcpp.
From-SVN: r195162
2013-01-14 18:13:59 +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
Dodji Seketeli 0b2c4be5fd PR preprocessor/7263 - Avoid pedantic warnings on system headers macro tokens
Now that we track token locations accross macro expansions, it would
be cool to be able to fix PR preprocessor/7263 for real.  That is,
consider this example where we have a system header named header.h
like this:

	#define _Complex __complex__ #define _Complex_I 1.0iF

and then a normal C file like this:

    #include "header.h"

    static _Complex float c = _Complex_I;

If we compile the file with -pedantic, the usages of _Complex or
_Complex_I should not trigger any warning, even though __complex__ and
the complex literal are extensions to the standard C.

They shouldn't trigger any warning because _Complex and _Complex_I are
defined in a system header (and expanded in normal user code).

To be able to handle this, we must address two separate concerns.

First, warnings about non-standard usage of numerical literals are emitted
directly from within libcpp.  So we must teach libcpp's parser for numerical
literals to use virtual locations, instead of the spelling
location it uses today.  Once we have that, as the diagnostics machinery
already knows how to avoid emitting errors happening on tokens that come from
system headers, we win.

Second, there is the issue of tracking locations for declaration
specifiers, like the "_Complex" in the declaration:

	static _Complex float c;

For that, we need to arrange for each possible declaration specifier
to have its own location, because otherwise, we'd warn on e.g, on:

    _Complex float c;

but not on:

    static _Complex float c;

So this patch addresses the two concerns above.  It's actually a
follow-up on an earlier patch[1] I wrote as part of my initial work on
virtual locations.  We then agreed[2] that the second concern was
important to address before the patch could get a chance to go in.

[1]: http://gcc.gnu.org/ml/gcc-patches/2011-09/msg00957.html
[2]: http://gcc.gnu.org/ml/gcc-patches/2011-10/msg00264.html

Bootstrapped and tested on x86_64-unknown-linux-gnu against trunk.

libcpp/

	PR preprocessor/7263
	* include/cpplib.h (cpp_classify_number): Take a location
	parameter.
	* expr.c (SYNTAX_ERROR_AT, SYNTAX_ERROR2_AT): New diagnostic
	macros that take a location parameter.
	(cpp_classify_number): Take a (virtual) location parameter.  Use
	it for diagnostics.  Adjust comments.
	(eval_token): Take a location parameter.  Pass it to
	cpp_classify_number and to diagnostic routines.
	(_cpp_parse_expr): Use virtual locations of tokens when parsing
	expressions.  Pass a virtual location to eval_token and to
	diagnostic routines.

gcc/c-family/

	PR preprocessor/7263
	* c-lex.c (c_lex_with_flags):  Pass a virtual location to the call
	to cpp_classify_number.  For diagnostics, use the precise location
	instead of the global input_location.

gcc/
	PR preprocessor/7263
	* c-tree.h (enum c_declspec_word): Declare new enum.
	(struct c_declspecs::locations): New member.
	(declspecs_add_qual, declspecs_add_scspec)
	(declspecs_add_addrspace, declspecs_add_alignas): Take a new
	location parameter.
	* c-decl.c (build_null_declspecs): Initialize the new struct
	c_declspecs::locations member.
	(declspecs_add_addrspace): Take a location parameter for the
	address space.  Store it onto declaration specifiers.
	(declspecs_add_qual): Likewise, take a location parameter for the
	qualifier.
	(declspecs_add_type): Likewise, take a location parameter for the
	type specifier.
	(declspecs_add_scspec): Likewise, take a location parameter for
	the storage class specifier.
	(declspecs_add_attrs): Likewise, take a location parameter for the
	first attribute.
	(declspecs_add_alignas): Likewise, take a location parameter for
	the alignas token.
	(finish_declspecs): For diagnostics, use the location of the
	relevant declspec, instead of the global input_location.
	* c-parser.c (c_parser_parameter_declaration): Pass the precise
	virtual location of the declspec to the declspecs-setters.
	(c_parser_declspecs): Likewise.  Avoid calling c_parser_peek_token
	repeatedly.

gcc/cp/

	PR preprocessor/7263
	* cp-tree.h (enum cp_decl_spec): Add new enumerators to cover all
	the possible declarator specifiers so far.
	(struct cp_decl_specifier_seq::locations): Declare new member.
	(cp_decl_specifier_seq::{specs, type_location}): Remove.
	(decl_spec_seq_has_spec_p): Declare new function.
	* parser.c (cp_parser_check_decl_spec): Remove.
	(set_and_check_decl_spec_loc): Define new static function.
	(decl_spec_seq_has_spec_p): Define new public function.
	(cp_parser_decl_specifier_seq, cp_parser_function_specifier_opt)
	(cp_parser_type_specifier, cp_parser_simple_type_specifier)
	(cp_parser_set_storage_class, cp_parser_set_decl_spec_type)
	(cp_parser_alias_declaration): Set the locations for each
	declspec, using set_and_check_decl_spec_loc.
	(cp_parser_explicit_instantiation, cp_parser_init_declarator)
	(cp_parser_member_declaration, cp_parser_init_declarator): Use the
	new declspec location for specifiers.  Use the new
	decl_spec_seq_has_spec_p.
	(cp_parser_type_specifier_seq): Use the new
	set_and_check_decl_spec_loc.  Stop using
	cp_parser_check_decl_spec.  Use the new decl_spec_seq_has_spec_p.
	(, cp_parser_init_declarator): Use the new
	set_and_check_decl_spec_loc.
	(cp_parser_single_declaration, cp_parser_friend_p)
	(cp_parser_objc_class_ivars, cp_parser_objc_struct_declaration):
	Use the new decl_spec_seq_has_spec_p.
	* decl.c (check_tag_decl): Use new decl_spec_seq_has_spec_p.  Use
	the more precise ds_redefined_builtin_type_spec location for
	diagnostics about re-declaring C++ built-in types.
	(start_decl, grokvardecl, grokdeclarator): Use the new
	decl_spec_seq_has_spec_p.

gcc/testsuite/

	PR preprocessor/7263
	* gcc.dg/binary-constants-2.c: Run without tracking locations
	accross macro expansion.
	* gcc.dg/binary-constants-3.c: Likewise.
	* gcc.dg/cpp/sysmac2.c: Likewise.
	* testsuite/gcc.dg/nofixed-point-2.c: Adjust for more precise
	location.
	* gcc.dg/cpp/syshdr3.c: New test.
	* gcc.dg/cpp/syshdr3.h: New header for the new test above.
	* gcc.dg/system-binary-constants-1.c: New test.
	* gcc.dg/system-binary-constants-1.h: New header for the new test
	above.
	* g++.dg/cpp/syshdr3.C: New test.
	* g++.dg/cpp/syshdr3.h: New header the new test above.
	* g++.dg/system-binary-constants-1.C: New test.
	* g++.dg/system-binary-constants-1.h: New header the new test
	above.

From-SVN: r187587
2012-05-16 12:51:15 +02:00
Tristan Gingold 638d20652b expr.c (interpret_float_suffix): Add a guard.
2012-05-10  Tristan Gingold  <gingold@adacore.com>

	* expr.c (interpret_float_suffix): Add a guard.

From-SVN: r187364
2012-05-10 08:04:18 +00:00
Ed Smith-Rowland 7e74ce3f94 re PR c++/50958 ([C++0x] raw literal operator provides incorrect string for integer literal '0')
PR c++/50958
gcc/cp/
	* parser.c (lookup_literal_operator): New.
	(cp_parser_userdef_char_literal): Use it.
	(cp_parser_userdef_numeric_literal): Use it.
	(cp_parser_userdef_string_literal): Use lookup_name.
libcpp/
	* expr.c (cpp_userdef_char_remove_type): Fix typo.

From-SVN: r181595
2011-11-21 14:27:30 -05:00
Ed Smith-Rowland 3ce4f9e4d2 Implement C++11 user-defined literals.
libcpp/
	* expr.c: (cpp_interpret_float_suffix, cpp_interpret_int_suffix,
	cpp_userdef_string_remove_type, cpp_userdef_string_add_type,
	cpp_userdef_char_remove_type, cpp_userdef_char_add_type,
	cpp_userdef_string_p, cpp_userdef_char_p, cpp_get_userdef_suffix): New.
	(cpp_classify_number): Classify unrecognized tokens as user-defined
	literals.
	* include/cpplib.h: Add new tokens for user-defined literals.
	* init.c: Add new preprocessor flag (cxx11).
	* lex.c: (lex_string, lex_raw_string): Handle user-defined literals
	including concatenation and promotion with suffixes.
c-family/
	* c-common.c (build_userdef_literal): New.
	* c-common.def: New tree code.
	* c-common.h (tree_userdef_literal): New tree struct and accessors.
	* c-lex.c (interpret_float): Add suffix parm.
	(c_lex_with_flags): Build literal tokens.
cp/
	* cp-objcp-common.c: (cp_tree_size) Return size of USERDEF_LITERAL tree.
	* cp-tree.h: (UDLIT_OP_*, UDLIT_OPER_P): Literal operator
	name tools. New tree code for user-defined literals.
	* cxx-pretty-print.h: (pp_cxx_userdef_literal) New.
	* cxx-pretty-print.c: (pp_cxx_userdef_literal) New.
	(pp_cxx_primary_expression, pp_cxx_expression): Use it.
	* decl.c: (cp_tree_node_structure): Return new tree code.
	(duplicate_decls): Check for raw vs. template operator conflicts.
	(grokfndecl, grokdeclarator): New checks for literal operators.
	* error.c: (dump_expr): Warn about user-defined literals
	in C++98 mode. (dump_function_name): Pretty printing.
	* mangle.c: (write_literal_operator_name): New.
	(write_unqualified_id, write_unqualified_name): Use it.
	* parser.c: (cp_parser_operator): Handle operator"".
	(cp_parser_userdef_char_literal, cp_parser_userdef_numeric_literal,
	cp_parser_userdef_string_literal): New.
	(cp_parser_primary_expression): Handle new user-defined literal tokens
	with new functions.
	* semantics.c: (potential_constant_expression_1): Add
	user-defined literals.
	* typeck.c (check_raw_literal_operator,
	check_literal_operator_args): New.

From-SVN: r180536
2011-10-26 15:30:59 -04:00
Michael Meissner f3c33d9dc8 Make UNSPEC/UNSPECV constants use the enum; Fix 48192; Add test case for 48053
From-SVN: r171247
2011-03-21 16:21:30 +00:00
Joseph Myers e3339d0f33 optc-gen.awk: Generate global_options initializer instead of individual variables.
gcc:
	* optc-gen.awk: Generate global_options initializer instead of
	individual variables.  Add x_ prefix to names of structure
	members.
	* opth-gen.awk: Generate gcc_options structure.  Add x_ prefix to
	names of structure members.
	* doc/tm.texi.in (HARD_FRAME_POINTER_IS_FRAME_POINTER,
	HARD_FRAME_POINTER_IS_ARG_POINTER): Document.
	* doc/tm.texi: Regenerate.
	* alias.c: Use HARD_FRAME_POINTER_IS_FRAME_POINTER
	* builtins.c: Use HARD_FRAME_POINTER_IS_ARG_POINTER.
	* c-parser.c (disable_extension_diagnostics,
	restore_extension_diagnostics): Update names of cpp_options
	members.
	* combine.c: Use HARD_FRAME_POINTER_IS_FRAME_POINTER
	* common.opt (fcompare-debug-second): Don't use Var.
	* config/alpha/alpha.h (target_flags): Remove.
	* config/arm/arm.h (HARD_FRAME_POINTER_IS_FRAME_POINTER,
	HARD_FRAME_POINTER_IS_ARG_POINTER): Define.
	* config/bfin/bfin.h (target_flags): Remove.
	* config/cris/cris.h (target_flags): Remove.
	* config/i386/i386-c.c (ix86_pragma_target_parse): Update names of
	cl_target_option members.
	* config/i386/i386.c (ix86_force_align_arg_pointer): Remove.
	(ix86_function_specific_print, ix86_valid_target_attribute_tree,
	ix86_can_inline_p): Update names of cl_target_option members.
	* config/i386/i386.h (ix86_isa_flags): Remove.
	* config/lm32/lm32.h (target_flags): Remove.
	* config/mcore/mcore.h (mcore_stack_increment): Remove.
	* config/mcore/mcore.md (addsi3): Remove extern declaration of
	flag_omit_frame_pointer.
	* config/mep/mep.h (target_flags): Remove.
	* config/mips/mips.h (HARD_FRAME_POINTER_IS_FRAME_POINTER,
	HARD_FRAME_POINTER_IS_ARG_POINTER): Define.
	* config/mmix/mmix.h (target_flags): Remove.
	* config/rs6000/rs6000.h (rs6000_xilinx_fpu, flag_pic,
	flag_expensive_optimizations): Remove.
	* config/s390/s390.h (flag_pic): Remove.
	* config/score/score-conv.h (target_flags): Remove.
	* config/sh/sh.h (sh_fixed_range_str): Remove.
	* config/spu/spu.h (target_flags, spu_fixed_range_string): Remove.
	* dbxout.c: Use HARD_FRAME_POINTER_IS_ARG_POINTER
	* df-scan.c: Use HARD_FRAME_POINTER_IS_FRAME_POINTER.
	* diagnostic.c (diagnostic_initialize): Update names of
	diagnostic_context members.
	* diagnostic.h (diagnostic_context): Rename inhibit_warnings and
	warn_system_headers.
	(diagnostic_report_warnings_p): Update for new names.
	* dwarf2out.c: Use HARD_FRAME_POINTER_IS_ARG_POINTER
	* emit-rtl.c: Use HARD_FRAME_POINTER_IS_FRAME_POINTER and
	HARD_FRAME_POINTER_IS_ARG_POINTER.
	* flags.h (flag_compare_debug): Declare.
	* ira.c: Use HARD_FRAME_POINTER_IS_FRAME_POINTER
	* opts.c (flag_compare_debug): Define.
	(common_handle_option): Update names of diagnostic_context
	members.  Handle -fcompare-debug-second.
	(fast_math_flags_struct_set_p): Update names of cl_optimization
	members.
	* reginfo.c: Use HARD_FRAME_POINTER_IS_FRAME_POINTER.
	* regrename.c: Use HARD_FRAME_POINTER_IS_FRAME_POINTER.
	* reload.c: Use HARD_FRAME_POINTER_IS_FRAME_POINTER.
	* reload1.c: Use HARD_FRAME_POINTER_IS_FRAME_POINTER.
	* resource.c: Use HARD_FRAME_POINTER_IS_FRAME_POINTER.
	* rtl.h (HARD_FRAME_POINTER_IS_FRAME_POINTER,
	HARD_FRAME_POINTER_IS_ARG_POINTER): Define and use.
	* sel-sched.c: Use HARD_FRAME_POINTER_IS_FRAME_POINTER
	* stmt.c: Use HARD_FRAME_POINTER_IS_ARG_POINTER.

gcc/c-family:
	* c-common.c (c_cpp_error): Update names of diagnostic_context
	members.
	* c-cppbuiltin.c (c_cpp_builtins_optimize_pragma): Update names of
	cl_optimization members.
	* c-opts.c (warning_as_error_callback, c_common_handle_option,
	sanitize_cpp_opts, finish_options): Update names of cpp_options
	members.

gcc/fortran:
	* cpp.c (cpp_define_builtins): Update names of gfc_option_t
	members.
	(gfc_cpp_post_options): Update names of cpp_options members.
	(cb_cpp_error): Update names of diagnostic_context members.
	* f95-lang.c (gfc_init_builtin_functions): Update names of
	gfc_option_t members.
	* gfortran.h (gfc_option_t): Rename warn_conversion and
	flag_openmp.
	* intrinsic.c (gfc_convert_type_warn): Update names of
	gfc_option_t members.
	* options.c (gfc_init_options, gfc_post_options, set_Wall,
	gfc_handle_option): Update names of gfc_option_t members.
	* parse.c (next_free, next_fixed): Update names of gfc_option_t
	members.
	* scanner.c (pedantic): Remove extern declaration.
	(skip_free_comments, skip_fixed_comments, include_line): Update
	names of gfc_option_t members.
	* trans-decl.c (gfc_generate_function_code): Update names of
	gfc_option_t members.

gcc/java:
	* java-tree.h (flag_filelist_file, flag_assert, flag_jni,
	flag_force_classes_archive_check, flag_redundant, flag_newer,
	flag_use_divide_subroutine, flag_use_atomic_builtins,
	flag_use_boehm_gc, flag_hash_synchronization,
	flag_check_references, flag_optimize_sci, flag_indirect_classes,
	flag_indirect_dispatch, flag_store_check,
	flag_reduced_reflection): Remove.
	* jcf-dump.c (flag_newer): Remove.
	* jcf.h (quiet_flag): Remove.
	* parse.h (quiet_flag): Remove.

libcpp:
	* include/cpplib.h (cpp_options): Rename warn_deprecated,
	warn_traditional, warn_long_long and pedantic.
	* directives.c (directive_diagnostics, _cpp_handle_directive):
	Update names of cpp_options members.
	* expr.c (cpp_classify_number, eval_token): Update names of
	cpp_options members.
	* init.c (cpp_create_reader, post_options): Update names of
	cpp_options members.
	* internal.h (CPP_PEDANTIC, CPP_WTRADITIONAL): Update names of
	cpp_options members.
	* macro.c (parse_params): Update names of cpp_options members.

From-SVN: r164723
2010-09-29 15:49:14 +01:00
Jakub Jelinek a69d2520e0 re PR preprocessor/45457 (ICE: invalid built-in macro "__DBL_DENORM_MIN__")
PR preprocessor/45457
	* expr.c (parse_defined): Call pfile->cb.user_builtin_macro hook if
	needed.
	* directives.c (do_ifdef, do_ifndef): Likewise.

	* c-c++-common/cpp/pr45457.c: New test.

From-SVN: r163705
2010-09-01 00:47:25 +02:00
Simon Baldwin 87cf065171 diagnostic.h (diagnostic_override_option_index): New macro to set a diagnostic's option_index.
* diagnostic.h (diagnostic_override_option_index): New macro to
	set a diagnostic's option_index.
	* c-tree.h (c_cpp_error): Add warning reason argument.
	* opts.c (_warning_as_error_callback): New.
	(register_warning_as_error_callback): Store callback for
	warnings enabled via enable_warning_as_error.
	(enable_warning_as_error): Call callback, minor code tidy.
	* opts.h (register_warning_as_error_callback): Declare.
	* c-opts.c (warning_as_error_callback): New, set cpp_opts flag in
	response to -Werror=.
	(c_common_init_options): Register warning_as_error_callback in opts.c.
	* common.opt: Add -Wno-cpp option.
	* c-common.c (struct reason_option_codes_t): Map cpp warning
	reason codes to gcc option indexes.
	* (c_option_controlling_cpp_error): New function, lookup the gcc
	option index for a cpp warning reason code.
	* (c_cpp_error): Add warning reason argument, call
	c_option_controlling_cpp_error for diagnostic_override_option_index.
	* doc/invoke.texi: Document -Wno-cpp.

	* cpp.c (cb_cpp_error): Add warning reason argument, set a value
	for diagnostic_override_option_index if CPP_W_WARNING_DIRECTIVE.

	* directives.c (do_diagnostic): Add warning reason argument,
	call appropriate error reporting function for code.
	(directive_diagnostics): Call specific warning functions with
	warning reason where appropriate.
	(do_error, do_warning, do_pragma_dependency): Add warning reason
	argument to do_diagnostic calls.
	* macro.c (_cpp_warn_if_unused_macro, enter_macro_context,
	_cpp_create_definition): Call specific warning functions with
        warning reason where appropriate.
	* Makefile.in: Add new diagnostic functions to gettext translations.
	* include/cpplib.h (struct cpp_callbacks): Add warning reason code
	to error callback.
	(CPP_DL_WARNING, CPP_DL_WARNING_SYSHDR, CPP_DL_PEDWARN, CPP_DL_ERROR,
	CPP_DL_ICE, CPP_DL_NOTE, CPP_DL_FATAL): Replace macros with enums.
	(CPP_W_NONE, CPP_W_DEPRECATED, CPP_W_COMMENTS,
	CPP_W_MISSING_INCLUDE_DIRS, CPP_W_TRIGRAPHS, CPP_W_MULTICHAR,
	CPP_W_TRADITIONAL, CPP_W_LONG_LONG, CPP_W_ENDIF_LABELS,
	CPP_W_NUM_SIGN_CHANGE, CPP_W_VARIADIC_MACROS,
	CPP_W_BUILTIN_MACRO_REDEFINED, CPP_W_DOLLARS, CPP_W_UNDEF,
	CPP_W_UNUSED_MACROS, CPP_W_CXX_OPERATOR_NAMES, CPP_W_NORMALIZE,
	CPP_W_INVALID_PCH, CPP_W_WARNING_DIRECTIVE): New enums for cpp
	warning reason codes.
	(cpp_warning, cpp_pedwarning, cpp_warning_syshdr,
	cpp_warning_with_line, cpp_pedwarning_with_line,
	cpp_warning_with_line_syshdr): New specific error reporting functions.
	* pch.c (cpp_valid_state): Call specific warning functions with
        warning reason where appropriate.
	* errors.c (cpp_diagnostic, cpp_diagnostic_with_line): New central
	diagnostic handlers.
	(cpp_warning, cpp_pedwarning, cpp_warning_syshdr,
	cpp_warning_with_line, cpp_pedwarning_with_line,
	cpp_warning_with_line_syshdr): New specific error reporting functions.
	* expr.c (cpp_classify_number, eval_token, num_unary_op): Call
	specific warning functions with warning reason where appropriate.
	* lex.c (_cpp_process_line_notes, _cpp_skip_block_comment,
	warn_about_normalization, lex_identifier_intern, lex_identifier,
	_cpp_lex_direct): Ditto.
	* charset.c (_cpp_valid_ucn, convert_hex, convert_escape,
	narrow_str_to_charconst): Ditto.

	* gcc.dg/cpp/warn-undef-2.c: New.
	* gcc.dg/cpp/warn-traditional-2.c: New.
	* gcc.dg/cpp/warn-comments-2.c: New.
	* gcc.dg/cpp/warning-directive-1.c: New.
	* gcc.dg/cpp/warn-long-long.c: New.
	* gcc.dg/cpp/warn-traditional.c: New.
	* gcc.dg/cpp/warn-variadic-2.c: New.
	* gcc.dg/cpp/warn-undef.c: New.
	* gcc.dg/cpp/warn-normalized-1.c: New.
	* gcc.dg/cpp/warning-directive-2.c: New.
	* gcc.dg/cpp/warn-long-long-2.c: New.
	* gcc.dg/cpp/warn-variadic.c: New.
	* gcc.dg/cpp/warn-normalized-2.c: New.
	* gcc.dg/cpp/warning-directive-3.c: New.
	* gcc.dg/cpp/warn-deprecated-2.c: New.
	* gcc.dg/cpp/warn-trigraphs-1.c: New.
	* gcc.dg/cpp/warn-multichar-2.c: New.
	* gcc.dg/cpp/warn-normalized-3.c: New.
	* gcc.dg/cpp/warning-directive-4.c: New.
	* gcc.dg/cpp/warn-unused-macros.c: New.
	* gcc.dg/cpp/warn-trigraphs-2.c: New.
	* gcc.dg/cpp/warn-cxx-compat-2.c: New.
	* gcc.dg/cpp/warn-cxx-compat.c: New.
	* gcc.dg/cpp/warn-redefined.c: New.
	* gcc.dg/cpp/warn-trigraphs-3.c: New.
	* gcc.dg/cpp/warn-unused-macros-2.c: New.
	* gcc.dg/cpp/warn-deprecated.c: New.
	* gcc.dg/cpp/warn-trigraphs-4.c: New.
	* gcc.dg/cpp/warn-redefined-2.c: New.
	* gcc.dg/cpp/warn-comments.c: New.
	* gcc.dg/cpp/warn-multichar.c: New.
	* g++.dg/cpp/warning-directive-1.C: New.
	* g++.dg/cpp/warning-directive-2.C: New.
	* g++.dg/cpp/warning-directive-3.C: New.
	* g++.dg/cpp/warning-directive-4.C: New.
	* gfortran.dg/warning-directive-1.F90: New.
	* gfortran.dg/warning-directive-3.F90: New.
	* gfortran.dg/warning-directive-2.F90: New.
	* gfortran.dg/warning-directive-4.F90: New.

From-SVN: r158079
2010-04-07 17:18:10 +00:00
Joseph Myers dadab4fd22 re PR preprocessor/41947 (GCC Hexadecimal Floating point constant handling)
libcpp:
	PR preprocessor/41947
	* expr.c (cpp_classify_number): Give error for hexadecimal
	floating-point constant with no digits before or after point.

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

From-SVN: r155558
2010-01-01 18:08:17 +00:00
Manuel López-Ibáñez b506a5a238 expr.c (num_div_op): Take explicit location.
2009-06-18  Manuel López-Ibáñez  <manu@gcc.gnu.org>

libcpp/	
	* expr.c (num_div_op): Take explicit location.
testsuite/	
	* gcc.dg/cpp/arith-3.c: Add column info.

From-SVN: r148662
2009-06-18 15:10:23 +00:00
Joseph Myers 9a0c618755 c-lex.c (c_lex_with_flags): Expect cpp_hashnode in tok->val.node.node.
gcc:
	* c-lex.c (c_lex_with_flags): Expect cpp_hashnode in
	tok->val.node.node.

libcpp:
	* include/cpplib.h (enum cpp_token_fld_kind): Add
	CPP_TOKEN_FLD_TOKEN_NO.
	(struct cpp_macro_arg, struct cpp_identifier): Define.
	(union cpp_token_u): Use struct cpp_identifier for identifiers.
	Use struct cpp_macro_arg for macro arguments.  Add token_no for
	CPP_PASTE token numbers.
	* directives.c (_cpp_handle_directive, lex_macro_node, do_pragma,
	do_pragma_poison, parse_assertion): Use val.node.node in place of
	val.node.
	* expr.c (parse_defined, eval_token): Use val.node.node in place
	of val.node.
	* lex.c (cpp_ideq, _cpp_lex_direct, cpp_token_len,
	cpp_spell_token, cpp_output_token, _cpp_equiv_tokens,
	cpp_token_val_index): Use val.macro_arg.arg_no or val.token_no in
	place of val.arg_no.  Use val.node.node in place of val.node.
	* macro.c (replace_args, cpp_get_token, parse_params,
	lex_expansion_token, create_iso_definition, cpp_macro_definition):
	Use val.macro_arg.arg_no or val.token_no in place of val.arg_no.
	Use val.node.node in place of val.node.

From-SVN: r147341
2009-05-10 15:27:32 +01:00
Joseph Myers 813b9e7e20 Fix typo in comment in previous commit.
From-SVN: r146779
2009-04-25 19:59:20 +01:00
Joseph Myers f88d07724f re PR preprocessor/39559 (constants too large for intmax_t need pedwarns)
libcpp:
	PR preprocessor/39559
	* expr.c (cpp_interpret_integer): Use a pedwarn for decimal
	constants larger than intmax_t in C99 mode.

gcc/testsuite:
	* gcc.dg/c99-intconst-2.c: New test.

From-SVN: r146777
2009-04-25 19:46:03 +01:00
Manuel López-Ibáñez 9c650d90ab re PR c++/13358 (long long and C++ do not mix well)
2009-04-21  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>

	PR c++/13358
	* doc/invoke.texi (-Wlong-long): Update description.
	* c-lex (interpret_integer): Only warn if there was no previous
	overflow and -Wlong-long is enabled.
	* c-decl.c (declspecs_add_type): Drop redundant flags.
	* c.opt (Wlong-long): Init to -1.
	* c-opts.c (sanitize_cpp_opts): Synchronize cpp's warn_long_long
	and front-end warn_long_long. Wlong-long only depends on other
	flags if it is uninitialized.
	* c-parser.c (disable_extension_diagnostics): warn_long_long is
	the same for CPP and FE.
	(restore_extension_diagnostics): Likewise.
libcpp/
	* init.c (cpp_create_reader): Wlong_long is disabled by default.
	* expr.c (cpp_classify_number): Give different messages for C and
	C++ front-ends.
cp/
	* parser.c (cp_parser_check_decl_spec): Drop redundant flags.
	* error.c (pedwarn_cxx98): New.
	* cp-tree.h (pedwarn_cxx98): Declare.
testsuite/
	* gcc.dg/wtr-int-type-1.c: Use two dg-warning to match two
	messages. Test for "long long" in system headers.
	* gcc.dg/c99-longlong-2.c: New.
	* g++.dg/warn/pr13358.C: New.
	* g++.dg/warn/pr13358-2.C: New.
	* g++.dg/warn/pr13358-3.C: New.
	* g++.dg/warn/pr13358-4.C: New.

From-SVN: r146459
2009-04-20 22:12:52 +00:00
Jakub Jelinek 748086b7b2 Licensing changes to GPLv3 resp. GPLv3 with GCC Runtime Exception.
From-SVN: r145841
2009-04-09 17:00:19 +02:00
Janis Johnson 839a3b8ab5 re PR target/39027 (double floating point suffix of 'd' and 'D' not accepted)
gcc/
	PR c/29027
	* c-lex.c (interpret_float): Default (no suffix) is double.

libcpp/
	PR c/29027
	* include/cpplib.h (CPP_N_DEFAULT): Define.
	* expr.c (interpret_float_suffix): Recognize d or D for double,
	return new value for default.
	(cpp_classify_number): Issue pedwarn for use of d or D in suffix.

gcc/testsuite/
	PR c/29027
	* gcc.dg/fltconst-1.c: Don't error for use of d or D in suffix.
	* gcc.dg/fltconst-2.c: New test.
	* gcc.dg/fltconst-double-pedantic-1.c: New test.
	* gcc.dg/fltconst-double-pedantic-2.c: New test.

From-SVN: r145422
2009-04-01 17:31:26 +00:00
Janis Johnson eec4911606 re PR c/33466 (mixed-case suffix for decimal float constants)
libcpp/
	PR c/33466
	* expr.c (interpret_float_suffix): Reject invalid suffix that uses
	letters from decimal float and fixed-point suffixes.

gcc/testsuite
	PR c/33466
	* gcc.dg/cpp/pr33466.c: New test.
	* gcc.dg/dfp/pr33466.c: New test.
	* gcc.dg/fixed-point/pr33466.c: New test.

From-SVN: r145417
2009-04-01 17:04:42 +00:00
Manuel López-Ibáñez 47960aaf16 expr.c (struct op): Add location.
2008-10-31  Manuel López-Ibáñez  <manu@gcc.gnu.org>

libcpp/
	* expr.c (struct op): Add location.
	(_cpp_parse_expr): Propagate locations throught the stack
	of expressions.
	(reduce): Likewise.
	(check_promotion): Use explicit location in errors.
	
testsuite/
	* gcc.dg/cpp/Wsignprom.c: Add column numbers.
	* gcc.dg/cpp/if-mpar.c: Likewise.

From-SVN: r141503
2008-10-31 22:00:37 +00:00
Tom Tromey d750887f5f re PR preprocessor/36320 (Required diagnosis of syntax error missed)
gcc/testsuite
	PR preprocessor/36320:
	* gcc.dg/cpp/pr36320.c: New file.
libcpp
	PR preprocessor/36320:
	* internal.h (_cpp_parse_expr): Update.
	* expr.c (_cpp_parse_expr): Add 'is_if' argument.  Update error
	messages.
	* directives.c (do_if): Update.
	(do_elif): Require expression if processing group.

From-SVN: r136209
2008-05-30 14:25:09 +00:00
Tom Tromey 899015a064 re PR preprocessor/22168 (#if #A == #B should have a diagnostic in ISO C mode)
libcpp
	PR preprocessor/22168:
	* include/cpplib.h (struct cpp_options) <objc>: Update
	documentation.
	* expr.c (eval_token): Warn for use of assertions.
	* directives.c (directive_diagnostics): Warn about extensions.
	(DEPRECATED): New define.
	(DIRECTIVE_TABLE): Use it.
gcc
	PR preprocessor/22168:
	* doc/cpp.texi (Top): Update menu.
	(Alternatives to Wrapper #ifndef): New node.
	(Other Directives): Document deprecation.
	(Obsolete Features): Remove menu.
	(Assertions): Merge node into Obsolete Features.
	(Obsolete once-only headers): Move earlier; rename to Alternatives
	to Wrapper #ifndef.
	* doc/cppopts.texi: Update.
	* c.opt (Wdeprecated): Enable for C and ObjC.
	* doc/invoke.texi (Option Summary): Move -Wno-deprecated.
	(C++ Dialect Options): Move -Wno-deprecated from here to...
	(Warning Options): ... here.
gcc/testsuite
	PR preprocessor/22168:
	* gcc.dg/pch/import-2.hs: Add -Wno-deprecated.
	* gcc.dg/pch/import-1.hs: Add -Wno-deprecated.
	* gcc.dg/pch/import-2.c: Add -Wno-deprecated.
	* gcc.dg/pch/import-1.c: Add -Wno-deprecated.
	* gcc.dg/cpp/import2.c: Add -Wno-deprecated.
	* gcc.dg/cpp/import1.c: Add -Wno-deprecated.
	* gcc.dg/cpp/trad/assert3.c: Add -Wno-deprecated.
	* gcc.dg/cpp/trad/assert2.c: Add -Wno-deprecated.
	* gcc.dg/cpp/trad/assert1.c: Add -Wno-deprecated.
	* gcc.dg/cpp/ident.c: Add -Wno-deprecated.
	* gcc.dg/cpp/ident-1.c: Add -Wno-deprecated.
	* gcc.dg/cpp/extratokens.c: Add -Wno-deprecated.
	* gcc.dg/cpp/assert3.c: Add -Wno-deprecated.
	* gcc.dg/cpp/assert2.c: Add -Wno-deprecated.
	* gcc.dg/cpp/assert1.c: Add -Wno-deprecated.
	* gcc.dg/cpp/assert4.c: Compile with -ansi and not -pedantic.  Add
	-Wno-deprecated.
	* gcc.dg/cpp/pr22168.c: New file.
	* gcc.dg/cpp/pr22168-2.c: New file.

From-SVN: r135264
2008-05-13 14:50:27 +00:00
Tom Tromey 71c10038d1 PR preprocessor/35313, PR preprocessor/36088:
gcc/testsuite
	PR preprocessor/35313, PR preprocessor/36088:
	* gcc.dg/cpp/pr35313.c: New file.
	* gcc.dg/cpp/if-oppr.c: Remove test for ',' in a conditional
	expression.
	* gcc.dg/cpp/if-oppr2.c: New file.
libcpp
	PR preprocessor/35313, PR preprocessor/36088:
	* expr.c (optab) <QUERY, COMMA>: Set precedence to 4.
	(reduce) <case CPP_QUERY>: Special case CPP_COMMA and CPP_COLON.

From-SVN: r134989
2008-05-06 17:15:07 +00:00
Kris Van Hees b6baa67d79 cpp-id-data.h (UC): Was U, conflicts with U...
libcpp/ChangeLog:
2008-04-14  Kris Van Hees <kris.van.hees@oracle.com>

* include/cpp-id-data.h (UC): Was U, conflicts with U... literal.
* include/cpplib.h (CHAR16, CHAR32, STRING16, STRING32): New tokens.
(struct cpp_options): Added uliterals.
(cpp_interpret_string): Update prototype.
(cpp_interpret_string_notranslate): Idem.
* charset.c (init_iconv_desc): New width member in cset_converter.
(cpp_init_iconv): Add support for char{16,32}_cset_desc.
(convert_ucn): Idem.
(emit_numeric_escape): Idem.
(convert_hex): Idem.
(convert_oct): Idem.
(convert_escape): Idem.
(converter_for_type): New function.
(cpp_interpret_string): Use converter_for_type, support u and U prefix.
(cpp_interpret_string_notranslate): Match changed prototype.
(wide_str_to_charconst): Use converter_for_type.
(cpp_interpret_charconst): Add support for CPP_CHAR{16,32}.
* directives.c (linemarker_dir): Macro U changed to UC.
(parse_include): Idem.
(register_pragma_1): Idem.
(restore_registered_pragmas): Idem.
(get__Pragma_string): Support CPP_STRING{16,32}.
* expr.c (eval_token): Support CPP_CHAR{16,32}.
* init.c (struct lang_flags): Added uliterals.
(lang_defaults): Idem.
* internal.h (struct cset_converter) <width>: New field.
(struct cpp_reader) <char16_cset_desc>: Idem.
(struct cpp_reader) <char32_cset_desc>: Idem.
* lex.c (digraph_spellings): Macro U changed to UC.
(OP, TK): Idem.
(lex_string): Add support for u'...', U'...', u... and U....
(_cpp_lex_direct): Idem.
* macro.c (_cpp_builtin_macro_text): Macro U changed to UC.
(stringify_arg): Support CPP_CHAR{16,32} and CPP_STRING{16,32}.

gcc/ChangeLog:
2008-04-14  Kris Van Hees <kris.van.hees@oracle.com>
  
* c-common.c (CHAR16_TYPE, CHAR32_TYPE): New macros.
(fname_as_string): Match updated cpp_interpret_string prototype.
(fix_string_type): Support char16_t* and char32_t*.
(c_common_nodes_and_builtins): Add char16_t and char32_t (and
derivative) nodes.  Register as builtin if C++0x.
(c_parse_error): Support CPP_CHAR{16,32}.
* c-common.h (RID_CHAR16, RID_CHAR32): New elements. 
(enum c_tree_index) <CTI_CHAR16_TYPE, CTI_SIGNED_CHAR16_TYPE,
CTI_UNSIGNED_CHAR16_TYPE, CTI_CHAR32_TYPE, CTI_SIGNED_CHAR32_TYPE,
CTI_UNSIGNED_CHAR32_TYPE, CTI_CHAR16_ARRAY_TYPE,
CTI_CHAR32_ARRAY_TYPE>: New elements.
(char16_type_node, signed_char16_type_node, unsigned_char16_type_node,
char32_type_node, signed_char32_type_node, char16_array_type_node,
char32_array_type_node): New defines.
* c-lex.c (cb_ident): Match updated cpp_interpret_string prototype.
(c_lex_with_flags): Support CPP_CHAR{16,32} and CPP_STRING{16,32}.
(lex_string): Support CPP_STRING{16,32}, match updated
cpp_interpret_string and cpp_interpret_string_notranslate prototypes.
(lex_charconst): Support CPP_CHAR{16,32}.
* c-parser.c (c_parser_postfix_expression): Support CPP_CHAR{16,32}
and CPP_STRING{16,32}.

gcc/cp/ChangeLog:
2008-04-14  Kris Van Hees <kris.van.hees@oracle.com>

* cvt.c (type_promotes_to): Support char16_t and char32_t.
* decl.c (grokdeclarator): Disallow signed/unsigned/short/long on
char16_t and char32_t.
* lex.c (reswords): Add char16_t and char32_t (for c++0x).
* mangle.c (write_builtin_type): Mangle char16_t/char32_t as vendor
extended builtin type u8char32_t.
* parser.c (cp_lexer_next_token_is_decl_specifier_keyword): Support
RID_CHAR{16,32}.
(cp_lexer_print_token): Support CPP_STRING{16,32}.
(cp_parser_is_string_literal): Idem.
(cp_parser_string_literal): Idem.
(cp_parser_primary_expression): Support CPP_CHAR{16,32} and
CPP_STRING{16,32}.
(cp_parser_simple_type_specifier): Support RID_CHAR{16,32}. 
* tree.c (char_type_p): Support char16_t and char32_t as char types.
* typeck.c (string_conv_p): Support char16_t and char32_t.

gcc/testsuite/ChangeLog:
2008-04-14  Kris Van Hees <kris.van.hees@oracle.com>

Tests for char16_t and char32_t support.
* g++.dg/ext/utf-cvt.C: New
* g++.dg/ext/utf-cxx0x.C: New
* g++.dg/ext/utf-cxx98.C: New
* g++.dg/ext/utf-dflt.C: New
* g++.dg/ext/utf-gnuxx0x.C: New
* g++.dg/ext/utf-gnuxx98.C: New
* g++.dg/ext/utf-mangle.C: New
* g++.dg/ext/utf-typedef-cxx0x.C: New
* g++.dg/ext/utf-typedef-
* g++.dg/ext/utf-typespec.C: New
* g++.dg/ext/utf16-1.C: New
* g++.dg/ext/utf16-2.C: New
* g++.dg/ext/utf16-3.C: New
* g++.dg/ext/utf16-4.C: New
* g++.dg/ext/utf32-1.C: New
* g++.dg/ext/utf32-2.C: New
* g++.dg/ext/utf32-3.C: New
* g++.dg/ext/utf32-4.C: New
* gcc.dg/utf-cvt.c: New
* gcc.dg/utf-dflt.c: New
* gcc.dg/utf16-1.c: New
* gcc.dg/utf16-2.c: New
* gcc.dg/utf16-3.c: New
* gcc.dg/utf16-4.c: New
* gcc.dg/utf32-1.c: New
* gcc.dg/utf32-2.c: New
* gcc.dg/utf32-3.c: New
* gcc.dg/utf32-4.c: New

libiberty/ChangeLog:
2008-04-14  Kris Van Hees <kris.van.hees@oracle.com>

* testsuite/demangle-expected: Added tests for char16_t and char32_t.

From-SVN: r134438
2008-04-18 09:58:08 -04:00
Joseph Myers 93d45d9eda cppopts.texi (-dU): Document.
gcc:
	* doc/cppopts.texi (-dU): Document.
	* c-common.h (flag_dump_macros): Update comment.
	* c-opts.c (handle_OPT_d): Handle -dU.
	* c-ppoutput.c (macro_queue, define_queue, undef_queue,
	dump_queued_macros, cb_used_define, cb_used_undef): New.
	(init_pp_output): Handle -dU.
	(cb_line_change): Call dump_queued_macros.
	* toplev.c (decode_d_option): Accept -dU as preprocessor option.

gcc/testsuite:
	* 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: New tests.

libcpp:
	* include/cpplib.h (struct cpp_callbacks): Add used_define,
	used_undef and before_define.
	(NODE_USED): Define.
	* directives.c (do_define, do_undef, undefine_macros, do_ifdef,
	do_ifndef, cpp_pop_definition): Handle new flag and use new
	callbacks.
	* expr.c (parse_defined): Handle new flag and use new callbacks.
	* macro.c (enter_macro_context, _cpp_free_definition): Handle new
	flag and use new callbacks.

From-SVN: r133847
2008-04-02 20:42:53 +01:00
Chao-ying Fu ac6b1c676c expr.c (interpret_float_suffix): Support hr, r, lr, llr, uhr, ur, ulr, ullr, hk, k, lk, llk, uhk, uk, ulk, ullk.
* expr.c (interpret_float_suffix): Support hr, r, lr, llr, uhr, ur,
	ulr, ullr, hk, k, lk, llk, uhk, uk, ulk, ullk.
	(cpp_classify_number): Support decimal fixed-point constants without
	exponents.
	Warn about fixed-point constants when -pedantic.
	* include/cpplib.h (CPP_N_SMALL, CPP_N_MEDIUM, CPP_N_LARGE): Change
	comments to support fixed-point values.
	(CPP_N_FRACT, CPP_N_ACCUM): Define.

From-SVN: r127940
2007-08-30 23:05:17 +00:00
Uros Bizjak c77cd3d140 cpplib.h (CPP_N_WIDTH_MD, [...]): Add new constants.
libcpp/ChangeLog:

	* include/cpplib.h (CPP_N_WIDTH_MD, CPP_N_MD_W, CPP_N_MD_Q):
	Add new constants.
	* expr.c (interpret_float_suffix): Process 'w', 'W', 'q' and 'Q'
	suffixes.  Return CPP_N_MD_W for 'w' or 'W' suffixes and CPP_N_MD_Q
	for 'q' or 'Q' suffixes.

gcc/ChangeLog:

	* targhooks.h (default_mode_for_suffix): New function declaration.
	* targhooks.c (default_mode_for_suffix): New default target hook.
	* target.h (struct c): New structure in the targetm struct.
	(mode_for_suffix): New target hook as part of struct c.
	target-def.h (TARGET_C_MODE_FOR_SUFFIX): Define as
	default_mode_for_suffix.
	(TARGET_C): New define.
	* c-lex.c: Include "target.h".
	(interpret_float): Use targetm.c.mode_for_suffix to determine
	the mode for a given non-standard suffix.
	Makefile.in (c-lex.o): Depend on $(TARGET_H).

	* config/i386/i386.c (ix86_c_mode_for_suffix): New static function.
	(TARGET_C_MODE_FOR_SUFFIX): Define to ix86_c_mode_for_suffix.

	* doc/extend.texi (Floating Types): New node.  Document __float80 and
	__float128 types.  Document 'w', 'W', 'q' and 'Q' suffixes.

testsuite/ChangeLog:

	* gcc.dg/const-float80.c : New test.
	* gcc.dg/const-float128.c : New test.
	* gcc.dg/const-float80-ped.c : New test.
	* gcc.dg/const-float128-ped.c : New test.

From-SVN: r126244
2007-07-03 07:53:58 +02:00
Joerg Wunsch f7fd775f02 re PR preprocessor/23479 (Implement binary constants with a "0b" prefix)
2007-06-05  Joerg Wunsch  <j.gnu@uriah.heep.sax.de>

	PR preprocessor/23479
gcc/
	* doc/extend.texi: Document the 0b-prefixed binary integer
	constant extension.

libcpp/
	* expr.c (cpp_classify_number): Implement 0b-prefixed binary
	integer constants.
	(append_digit): Likewise.
	* include/cpplib.h: Add CPP_N_BINARY, to be used for 0b-prefixed
	binary integer constants.

testsuite/
	* testsuite/gcc.dg/binary-constants-1.c: Add test suites for
	the 0b-prefixed binary integer constants.
	* testsuite/gcc.dg/binary-constants-2.c: Ditto.
	* testsuite/gcc.dg/binary-constants-3.c: Ditto.
	* testsuite/gcc.dg/binary-constants-4.c: Ditto.

From-SVN: r125346
2007-06-05 22:25:27 +00:00
Janis Johnson 5a6bb57eb9 expr.c (cpp_classify_number): Warn about dfp constant for -pedantic.
libcpp/
        * expr.c (cpp_classify_number): Warn about dfp constant for -pedantic.
gcc/testsuite/
        * gcc.dg/fltconst-pedantic-dfp.c: New test.

From-SVN: r124731
2007-05-14 23:45:40 +00:00
Janis Johnson 30e0492187 re PR c/31924 (gcc accepts invalid suffixes for decimal float constants)
libcpp/
        PR c/31924
        * expr.c (interpret_float_suffix): Check for invalid suffix.
gcc/testsuite/
        PR c/31924
        * gcc.dg/fltconst-1.c: New test.

From-SVN: r124730
2007-05-14 23:43:07 +00:00
Eric Christopher 22a8a52d65 if-div.c: New file.
2007-05-02  Eric Christopher  <echristo@apple.com>

	    * gcc.dg/cpp/if-div.c: New file.

2007-05-02  Eric Christopher  <echristo@apple.com>

	    * expr.c (num_div_op): Don't overflow if the result is
	    zero.

From-SVN: r124358
2007-05-02 21:57:50 +00:00
Steve Ellcey b52dbbf865 re PR c++/28288 (ICE with min/max operator)
PR c++/28288
	PR c++/14556
	* operators.def: Remove <?, ?>, <?=, and >?= operators.
	* parser.c: Remove CPP_MIN, CPP_MAX, CPP_MIN_EQ, and CPP_MAX_EQ.
	(cp_parser_warn_min_max): Remove.
	* include/cpplib.h: Remove <?, >?, <?=, and >?= tokens.
	(CPP_LAST_EQ): Change.
	(CPP_LAST_PUNCTUATOR): Change.
	* expr.c (cpp_operator): Remove MIN and MAX.
	(reduce): Remove CPP_MIN and CPP_MAX.
	(num_binary_op): Ditto.
	* lex.c (_cpp_lex_direct): Ditto.
	(cpp_avoid_paste): Remove ? as legal symbol after > or <.

From-SVN: r116140
2006-08-14 23:13:54 +00:00
Jon Grimm ad6ed77efd cpplib.h (CPP_N_DFLOAT): New.
* include/cpplib.h (CPP_N_DFLOAT): New.
	* expr.c (interpret_float_suffix): Identify df, dd, and dl
	suffixes as decimal floating point constants.
	(cpp_classify_number): Disallow hexadecimal DFP constants.

Co-Authored-By: Ben Elliston <bje@au.ibm.com>

From-SVN: r108133
2005-12-07 10:13:15 +11:00
Kelley Cook 200031d1d5 all files: Update FSF address in copyright headers.
2005-06-29  Kelley Cook  <kcook@gcc.gnu.org>

	* all files: Update FSF address in copyright headers.
	* makeucnid.c (write_copyright): Update outputted FSF address.

From-SVN: r101413
2005-06-29 02:34:39 +00:00
Gabriel Dos Reis c3f829c1a6 configure.ac: Check declarations for asprintf and vasprintf.
* configure.ac: Check declarations for asprintf and vasprintf.
	* config.in: Regenerate.
	* configure: Likewise.

	* charset.c (conversion_loop): Use XRESIZEVEC.
	(convert_no_conversion): Likewise.
	(convert_using_iconv): Likewise.
	(init_iconv_desc): Cast return value of alloca.
	(cpp_host_to_exec_charset): Use XNEWVEC.
	(emit_numeric_escape): Use XRESIZEVEC.
	(cpp_interpret_string): Use XNEWVEC.
	(cpp_interpret_string): Use XRESIZEVEC.
	(_cpp_interpret_identifier): Cast return value of alloca.
	(_cpp_convert_input): Use XNEWVEC and XRESIZEVEC.
	* directives.c (glue_header_name): Use XNEWVEC and XRESIZEVEC.
	(parse_include): Use XNEWVEC.
	(insert_pragma_entry): Rename local variable "new" to
	"new_entry".
	(save_registered_pragmas): Cast return value of xmemdup.
	(destringize_and_run): Same for alloca.
	(parse_assertion): Likewise.
	(do_assert): Cast allocated storage to proper type.
	(cpp_define): Likewise.
	(_cpp_define_builtin): Likewise.
	(cpp_undef): Likewise.
	(handle_assertion): Likewise.
	(cpp_push_buffer): Rename local variable "new" to "new_buffer".
	* expr.c (CPP_UPLUS): Cast value to type cpp_ttype.
	(CPP_UMINUS): Likewise.
	(struct cpp_operator): Rename from struct operator.
	(_cpp_expand_op_stack): Use XRESIZEVEC.
	* files.c (pch_open_file): Use XNEWVEC.
	(pch_open_file): Use XRESIZEVEC.
	(read_file_guts): Use XNEWVEC and XRESIZEVEC.
	(dir_name_of_file): Use XNEWVEC.
	(make_cpp_file): Use XCNEW.
	(make_cpp_dir): Likewise.
	(allocate_file_hash_entries): USE XNEWVEC.
	(cpp_included): Cast return value of htab_find_with_hash.
	(append_file_to_dir): Use XNEWVEC.
	(read_filename_string): Likewise. Use XRESIZEVEC too.
	(read_name_map): Cast return value of alloca.  Use XRESIZEVEC.
	(remap_filename): Use XNEWVEC.
	(struct pchf_entry): Move definition out of struct pchf_data.
	(_cpp_save_file_entries): Use XCNEWVAR.
	(_cpp_read_file_entries): Use XNEWVAR.
	* identifiers.c (alloc_node): Use XOBNEW.
	* init.c (cpp_create_reader): Use XCNEW.
	(cpp_init_builtins): Cast of b->value to enum builtin_type.
	(read_original_directory): Cast return value of alloca.
	* lex.c (add_line_note): Use XRESIZEVEC.
	(warn_about_normalization): Use XNEWVEC.
	(_cpp_lex_direct): Cast node->directive_index to (enum cpp_ttype).
	(new_buff): Use XNEWVEC.
	* line-map.c (linemap_add): Use XRESIZEVEC.
	* macro.c (builtin_macro): Cast return value of alloca.
	(paste_tokens): Likewise.
	(expand_arg): Use XNEWVEC and XRESIZEVEC.
	(_cpp_save_parameter): Use XRESIZEVEC.
	(create_iso_definition): Cast allocated storage to proper type.
	(_cpp_create_definition): Likewise.
	(cpp_macro_definition): Use XRESIZEVEC.
	* makedepend.c (add_clm): Use XNEW.
	(add_dir): Likewise.
	* mkdeps.c (munge): Use XNEWVEC.
	(deps_init): Use XCNEW.
	(deps_add_target): Use XRESIZEVEC.
	(deps_add_default_target): Cast return value of alloca.
	(deps_add_dep): Use XRESIZEVEC.
	(deps_add_vpath): Likewise.  Use XNEWVEC too.
	(deps_restore): Likewise.
	* pch.c (save_idents): Use XNEW and XNEWVEC.
	(cpp_save_state): Use XNEW.
	(count_defs): Cast return value of htab_find.
	(write_defs): Likewise.
	(cpp_write_pch_deps): Use XNEWVEC.
	(collect_ht_nodes): Use XRESIZEVEC.
	(cpp_valid_state): Use XNEWVEC.
	(save_macros): Use XRESIZEVEC.  Cast return value of xmemdup.
	* symtab.c (ht_create): Use XCNEW.
	(ht_lookup_with_hash): Cast return value of obstack_copy0.
	(ht_expand): Use XCNEWVEC.
	* system.h (HAVE_DESIGNATED_INITIALIZERS): False if __cplusplus.
	(bool): Do not define if __cplusplus.

From-SVN: r100295
2005-05-28 15:52:48 +00:00