Commit Graph

168 Commits

Author SHA1 Message Date
Daniel Franke 28f6862553 cpplib.h (cpp_define_formatted): New.
2008-04-22  Daniel Franke  <franke.daniel@gmail.com>

        * include/cpplib.h (cpp_define_formatted): New.
        * directives.c (cpp_define_formatted): New.

From-SVN: r134564
2008-04-22 14:04:32 -04:00
Tom Tromey 688e7a5344 re PR preprocessor/33415 (Can't compile .cpp file with UTF-8 BOM.)
libcpp
	PR libcpp/33415:
	* charset.c (_cpp_convert_input): Add buffer_start argument.
	Ignore UTF-8 BOM if seen.
	* internal.h (_cpp_convert_input): Add argument.
	* files.c (struct _cpp_file) <buffer_start>: New field.
	(destroy_cpp_file): Free buffer_start, not buffer.
	(_cpp_pop_file_buffer): Likewise.
	(read_file_guts): Update.
gcc/testsuite
	PR libcpp/33415:
	* gcc.dg/cpp/pr33415.c: New file.

From-SVN: r134507
2008-04-21 14:02:00 +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
Paolo Bonzini deb984e6de re PR other/35457 (Error building GCC trunk on CELL SPU)
2008-04-18  Paolo Bonzini  <bonzini@gnu.org>

	PR bootstrap/35457
	* configure.ac: Include override.m4.
	* configure: Regenerate.

libgomp:
2008-04-18  Paolo Bonzini  <bonzini@gnu.org>

	PR bootstrap/35457
	* aclocal.m4: Regenerate.
	* configure: Regenerate.

libdecnumber:
2008-04-18  Paolo Bonzini  <bonzini@gnu.org>

	PR bootstrap/35457
	* aclocal.m4: Regenerate.
	* configure: Regenerate.

gcc:
2008-04-18  Paolo Bonzini  <bonzini@gnu.org>

	PR bootstrap/35457
	* aclocal.m4: Regenerate.
	* configure: Regenerate.

libstdc++-v3:
2008-04-18  Paolo Bonzini  <bonzini@gnu.org>

	PR bootstrap/35457
	* aclocal.m4: Regenerate.
	* configure: Regenerate.

libobjc:
2008-04-18  Paolo Bonzini  <bonzini@gnu.org>

	PR bootstrap/35457
	* aclocal.m4: Regenerate.
	* configure: Regenerate.

intl:
2008-04-18  Paolo Bonzini  <bonzini@gnu.org>

	PR bootstrap/35457
	* aclocal.m4: Regenerate.
	* configure: Regenerate.

libgfortran:
2008-04-18  Paolo Bonzini  <bonzini@gnu.org>

	PR bootstrap/35457
	* aclocal.m4: Regenerate.
	* configure: Regenerate.

libmudflap:
2008-04-18  Paolo Bonzini  <bonzini@gnu.org>

	PR bootstrap/35457
	* aclocal.m4: Regenerate.
	* configure: Regenerate.

boehm-gc:
2008-04-18  Paolo Bonzini  <bonzini@gnu.org>

	PR bootstrap/35457
	* aclocal.m4: Regenerate.
	* configure: Regenerate.

libiberty:
2008-04-18  Paolo Bonzini  <bonzini@gnu.org>

	PR bootstrap/35457
	* aclocal.m4: Add override.m4.
	* configure: Regenerate.

libffi:
2008-04-18  Paolo Bonzini  <bonzini@gnu.org>

	PR bootstrap/35457
	* aclocal.m4: Regenerate.
	* configure: Regenerate.

libssp:
2008-04-18  Paolo Bonzini  <bonzini@gnu.org>

	PR bootstrap/35457
	* aclocal.m4: Regenerate.
	* configure: Regenerate.

config:
2008-04-18  Paolo Bonzini  <bonzini@gnu.org>

	PR bootstrap/35457

	* confsubdir.m4: Rename to...
	* override.m4: ... this.  Make sure aclocal always picks it.
	Add more lenient precious variable check, backported from
	autoconf trunk.

libjava/libltdl:
2008-04-18  Paolo Bonzini  <bonzini@gnu.org>

	PR bootstrap/35457
	* aclocal.m4: Regenerate.
	* configure: Regenerate.

libjava/classpath:
2008-04-18  Paolo Bonzini  <bonzini@gnu.org>

	PR bootstrap/35457
	* aclocal.m4: Regenerate.
	* configure: Regenerate.

libjava:
2008-04-18  Paolo Bonzini  <bonzini@gnu.org>

	PR bootstrap/35457
	* aclocal.m4: Regenerate.
	* configure: Regenerate.

libcpp:
2008-04-18  Paolo Bonzini  <bonzini@gnu.org>

	PR bootstrap/35457
	* aclocal.m4: Regenerate.
	* configure: Regenerate.

fixincludes:
2008-04-18  Paolo Bonzini  <bonzini@gnu.org>

	PR bootstrap/35457
	* Makefile.in: Rewrite aclocal.m4 rule.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.

From-SVN: r134434
2008-04-18 10:28:53 +00:00
Tom Tromey bf048bea9c re PR preprocessor/34866 (valgrind error indication in testsuite from errors.c:156:cpp_error with gcc.dg/cpp/Wmissingdirs.c)
PR libcpp/34866:
	* errors.c (cpp_error): Don't reference a token before the start
	of the current run.

From-SVN: r134421
2008-04-18 00:58:58 +00:00
Tom Tromey 7f27b0f8a2 Makefile.in (TAGS_SOURCES): New variable.
* Makefile.in (TAGS_SOURCES): New variable.
	(TAGS): New target.

From-SVN: r134367
2008-04-16 21:10:37 +00:00
Kaz Kojima a1fcb9a1de config.gcc (need_64bit_hwint): Need 64bit hwint for sh-*-*.
* config.gcc (need_64bit_hwint): Need 64bit hwint for sh-*-*.

	[libcpp]
	* configure.ac: (need_64bit_hwint): Need 64bit hwint for sh-*-*
	and shbe-*-*.
	* configure: Rebuilt.

From-SVN: r134190
2008-04-11 04:21:18 +00: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
Jakub Jelinek d4c32e1d76 re PR pch/13675 (#including a precompiled header more than once in the same unit fails)
PR pch/13675
	* files.c (struct _cpp_file): Remove pch field.
	(pch_open_file): Don't set file->pch, just file->pchname.
	(should_stack_file): After pfile->cb.read_pch call
	free pchname and clear pchname, don't close file->fd.
	Test file->pchname instead of file->pch.  Don't close fd after cb.
	(_cpp_stack_include): Test file->pchname instead of file->pch.

	* c-pch.c (c_common_read_pch): On error close (fd) resp. fclose (f).

From-SVN: r133790
2008-04-01 12:58:02 +02:00
Tom Tromey 161031e3ae Makefile.in (POSTCOMPILE): New variable.
* Makefile.in (POSTCOMPILE): New variable.
	(.c.o): Use it.

From-SVN: r133682
2008-03-28 13:32:47 +00:00
Tom Tromey 14ccf8003e re PR preprocessor/35322 (ICE with incomplete macro)
gcc/testsuite
	PR libcpp/35322:
	* gcc.dg/cpp/pr35322.c: New file.
libcpp
	PR libcpp/35322:
	* directives.c (destringize_and_run): Set pfile->directive.

From-SVN: r133195
2008-03-13 21:10:07 +00:00
Markus Milleder 830465c6ea re PR preprocessor/35458 (Dependency generation (-M) does not quote '#' in filenames)
libcpp
2008-03-06  Markus Milleder  <markus.milleder@generali.at>
	PR preprocessor/35458
	* mkdeps.c (munge): Quote '#' with a '\'.
gcc/testsuite
2008-03-06  Markus Milleder  <markus.milleder@generali.at>
	PR preprocessor/35458
	* gcc.dg/cpp/cmdlne-M-2.c: New file.
	* gcc.dg/cpp/cmdlne-M-2#.h: New file.
	* gcc.dg/cpp/#cmdlne-M-2.h: New file.

From-SVN: r132982
2008-03-06 18:08:40 +00:00
Ralf Wildenhues d482a07324 re PR preprocessor/35379 (-MT generates a target string too long over two lines)
libcpp:
	PR preprocessor/35379
	* mkdeps.c (deps_write): Ensure the first target always appears
	in the first column, without leading backslash newline.  Avoid
	some more extra whitespace.

From-SVN: r132727
2008-02-27 21:42:23 +00:00
Thiemo Seufer 185a6cc159 Makefile.in ($(srcdir)/config.in): Depend on configure.ac.
From-SVN: r132670
2008-02-26 11:41:01 +00:00
Tom Tromey 2bf41bf05d traditional.c (lex_identifier): Use CPP_HASHNODE.
* traditional.c (lex_identifier): Use CPP_HASHNODE.
	* lex.c (lex_identifier): Use CPP_HASHNODE.
	* include/line-map.h (LINEMAP_POSITION_FOR_COLUMN): Wrap in
	do-while.
	* identifiers.c (alloc_node): Change return type.
	(_cpp_init_hashtable): Don't cast 'alloc_node'.
	(proxy_assertion_broken): New declaration.
	(cpp_forall_identifiers): Move comment.
	* line-map.c (linemap_add): Comment fix.
	(linemap_line_start): Indentation fix.

From-SVN: r132467
2008-02-20 02:16:43 +00:00
Jakub Jelinek 765d600ac5 re PR preprocessor/34692 (Internal error with pragma in macro)
PR preprocessor/34692
	* macro.c (collect_args): Add pragma_buff argument.  Push
	CPP_PRAGMA ... CPP_PRAGMA_EOL tokens to *pragma_buff, rather
	than into arguments.  Reset prevent_expansion and parsing_args
	state at CPP_PRAGMA_EOL/CPP_EOF.
	(funlike_invocation_p): Add pragma_buff argument, pass it through
	to collect_args.
	(enter_macro_context): Add result argument.  Adjust
	funlike_invocation_p caller.  Emit all deferred pragma tokens
	gathered during collect_args before the expansion, add a padding
	token.  Return 2 instead of 1 if any pragma tokens were prepended.
	(cpp_get_token): If enter_macro_context returns 2, don't return
	a padding token, instead cycle to grab CPP_PRAGMA token.
	* directives.c (_cpp_handle_directive): If was_parsing_args
	in deferred pragma, leave parsing_args and prevent_expansion as is.

	* gcc.dg/cpp/pr34692.c: New test.
	* gcc.dg/gomp/pr34692.c: New test.

From-SVN: r131819
2008-01-25 10:01:27 +01:00
Tom Tromey ec46053bfa re PR c++/34859 (g++ -D__STDC_LIMIT_MACROS -D__STDC_LIMIT_MACROS causes error)
libcpp
	PR c++/34859:
	* macro.c (_cpp_create_definition): Handle __STDC_LIMIT_MACROS and
	__STDC_CONSTANT_MACROS.
gcc/testsuite
	PR c++/34859:
	* gcc.dg/cpp/pr34859.c: New file.

From-SVN: r131743
2008-01-22 21:43:49 +00:00
Fred Fish 681c6ab0da re PR preprocessor/30363 (Support for -traditional-cpp is incomplete in current gcc relative to gcc 2.95.3)
libcpp
2008-01-07  Fred Fish  <fnf@specifix.com>
	PR preprocessor/30363:
	* traditional.c (replace_args_and_push): Add local variable
	cxtquote, calculate the replacement text size assuming a 
	worst case of every input character quoted with backslash,
	and properly handle output quoting of quote characters in
	actual arguments used in function-like macros.
gcc/testsuite
2008-01-07  Fred Fish  <fnf@specifix.com>
	PR preprocessor/30363:
	* gcc.dg/cpp/trad/macroargs.c: Add code to test quoting in
	macro expansions.

From-SVN: r131379
2008-01-07 17:23:40 +00:00
Tom Tromey 33ae48375f re PR preprocessor/34602 (Internal error with invalid #line directive)
libcpp
	PR preprocessor/34602.
	* directives.c (do_line): Don't try to spell EOF token.
	(do_linemarker): Add comment.
gcc/testsuite
	PR preprocessor/34602:
	* gcc.dg/cpp/pr34602.c: New file.

From-SVN: r131304
2008-01-03 17:58:26 +00:00
DJ Delorie 675575f57a charset.c (convert_using_iconv): Close out any shift states, returning to the initial state.
* charset.c (convert_using_iconv): Close out any shift states,
returning to the initial state.

From-SVN: r130785
2007-12-11 20:38:10 -05:00
Tom Tromey 97f6bd406c re PR c/29172 (--combine can't handle #pragma once)
gcc
	PR c/29172:
	* c-opts.c (c_common_parse_file): Call cpp_clear_file_cache.
libcpp
	PR c/29172:
	* internal.h (struct cpp_reader) <file_hash_entries>: Changed
	type.
	<file_hash_entries_allocated, file_hash_entries_used>: Removed.
	* files.c (FILE_HASH_POOL_SIZE): New macro.
	(struct file_hash_entry_pool): New.
	(destroy_all_cpp_files): New function.
	(allocate_file_hash_entries): Allocate a file_hash_entry_pool.
	(new_file_hash_entry): Update.
	(free_file_hash_entries): New function.
	(_cpp_cleanup_files): Call free_file_hash_entries and
	destroy_all_cpp_files.
	(cpp_clear_file_cache): New function.
	* include/cpplib.h (cpp_clear_file_cache): Declare.

From-SVN: r130656
2007-12-06 18:56:26 +00:00
Tom Tromey d56a25e130 ( 5)
From-SVN: r130586
2007-12-03 21:04:47 +00:00
Tom Tromey 607f74e9c6 re PR preprocessor/32868 (Don't warn about redefinitions of __STDC_FORMAT_MACROS)
libcpp
	PR preprocessor/32868:
	* macro.c (_cpp_create_definition): Special case
	__STDC_FORMAT_MACROS.
gcc/testsuite
	PR preprocessor/32868:
	* gcc.dg/cpp/pr32868.c: New file.

From-SVN: r130544
2007-11-30 18:24:01 +00:00
Tom Tromey dc3800e59e Really remove accidentally committed ChangeLog entry
From-SVN: r130541
2007-11-30 17:44:03 +00:00
Michael Matz b0f4807f9e * files.c (search_path_head): Fix check for absolute paths.
From-SVN: r130229
2007-11-16 13:46:57 +00:00
Tom Tromey 7803a05def Fix erroneous ChangeLog change
From-SVN: r130094
2007-11-12 00:40:07 +00:00
Tom Tromey f1e207107a re PR c++/17577 (#pragma implementation no longer diagnoses use after file to which it applies)
gcc/cp
	PR c++/17577:
	* lex.c (handle_pragma_implementation): Use cpp_included_before.
gcc/testsuite
	PR c++/17577:
	* g++.dg/ext/pr17577.h: New file.
	* g++.dg/ext/pr17577.C: New file.
libcpp
	PR c++/17557:
	* include/cpplib.h (cpp_included_before): Declare.
	* files.c (struct file_hash_entry) <location>: New field.
	(_cpp_find_file): Initialize new field.
	(make_cpp_dir): Likewise.
	(cpp_included_before): New function.

From-SVN: r130093
2007-11-12 00:38:48 +00:00
Tom Tromey f373b44d28 re PR preprocessor/30805 (Internal compiler error when using "x##,##__VA_ARGS__" in macro)
libcpp
	PR preprocessor/30805:
	* macro.c (paste_tokens): Handle padding token.
	(paste_tokens): Don't abort unless padding has PASTE_LEFT flag.
gcc/testsuite
	PR preprocessor/30805:
	* gcc.dg/cpp/pr30805.c: New file.

From-SVN: r129827
2007-11-01 18:20:48 +00:00
Tom Tromey 5b9a40df4e re PR preprocessor/30786 (ICE on _Pragma at end of file)
gcc/testsuite
	PR preprocessor/30786:
	* gcc.dg/cpp/pr30786.c: New file.
libcpp
	PR preprocessor/30786:
	* macro.c (builtin_macro): Return result of _cpp_do__Pragma.
	* directives.c (_cpp_do__Pragma): Return error status.
	* internal.h (_cpp_do__Pragma): Update.
	* directives.c (get__Pragma_string): Back up if EOF seen.

From-SVN: r129800
2007-10-31 14:50:13 +00:00
Tom Tromey 5ffeb913b1 tree-cfg.c (remove_bb): Only warn if line is non-zero.
gcc:
	* tree-cfg.c (remove_bb): Only warn if line is non-zero.
	* c-pch.c (c_common_read_pch): Restore current location after
	reading PCH file.
	* tree.c (expand_location): Update.
	(expr_filename): Changed return type.  Unified the two cases.
	(expr_lineno): Likewise.
	(annotate_with_file_line): Don't use EXPR_LINENO and EXPR_FILENAME
	as lvalues.
	* toplev.c (line_table): Changed type.
	(general_init): Update.
	(realloc_for_line_map): New function.
	(general_init): Allocate line_table using GC.
	* fix-header.c (line_table): Changed type.
	(read_scan_file): Update.
	(read_scan_file): Update.
	* c-ppoutput.c (maybe_print_line): Update.
	(print_line): Update.
	(cb_line_change): Update.
	(cb_define): Update.
	(pp_file_change): Update.
	* c-opts.c (c_common_init_options): Update.
	(finish_options): Update.
	(push_command_line_include): Update.
	* c-lex.c (cb_line_change): Update.
	(cb_def_pragma): Update.
	(cb_define): Update.
	(cb_undef): Update.
	(c_lex_with_flags): Use cpp_get_token_with_location.
	* input.h (line_table): Changed type.
	(location_from_locus): New macro.
	* tree.h (EXPR_FILENAME): No longer an lvalue.
	(EXPR_LINENO): Likewise.
	(expr_locus, set_expr_locus): Declare separately for
	USE_MAPPED_LOCATION.
	(expr_filename, expr_lineno): Changed return type.
	* gimplify.c (tree_to_gimple_tuple): Use SET_EXPR_LOCUS.
	* cfgexpand.c (expand_gimple_cond_expr): Use location_from_locus.
	(expand_gimple_basic_block): Likewise.
	* final.c (final_scan_insn): Use expanded_location.
gcc/cp:
	* decl.c (finish_function): Put return's location on line zero of
	file.
gcc/fortran:
	* scanner.c (get_file): Update.
	(load_file): Update.
	(gfc_next_char_literal): Use gfc_linebuf_linenum.
	* f95-lang.c (gfc_init): Update.
	* gfortran.h (gfc_linebuf_linenum): New macro.
gcc/java:
	* lang.c (java_post_options): Update.
	* jcf-parse.c (set_source_filename): Update.
	(give_name_to_class): Update.
	(jcf_parse): Update.
	(duplicate_class_warning): Update.
	(parse_class_file): Update.
	(java_parse_file): Update.
	* expr.c (expand_byte_code): Update.
gcc/testsuite:
	* lib/g++.exp (g++_target_compile): Use -fno-show-column.
gcc/treelang:
	* tree1.c (treelang_init): Update.
	(treelang_parse_file): Update.
	(treelang_parse_file): Update.
	(treelang_parse_file): Update.
	* lex.l: Update.
	(update_lineno_charno): Likewise.
libcpp:
	* internal.h (struct cpp_reader) <invocation_location>: New
	field.
	(struct cpp_reader) <set_invocation_location>: Likewise.
	* init.c (cpp_set_line_map): New function.
	* line-map.c (linemap_add): Use linemap's allocator.
	* include/line-map.h (GTY): Define.
	(line_map_realloc): New typedef.
	(struct line_map): Mark with GTY.
	(struct line_maps): Likewise.
	(struct line_maps) <maps>: Likewise.
	(struct line_maps) <reallocator>: New field.
	* include/symtab.h (GTY): Conditionally define.
	* include/cpplib.h (cpp_set_line_map): Declare.
	(cpp_get_token_with_location): Declare.
	* macro.c (cpp_get_token): Set invocation_location on the reader.
	(cpp_get_token_with_location): New function.

From-SVN: r128190
2007-09-06 16:24:05 +00: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
Tom Tromey cda5e672d8 re PR preprocessor/32974 (#pragma GCC dependency generates extra token error.)
gcc/testsuite
	PR preprocessor/32974:
	* gcc.dg/cpp/pr32974.c: New file.
libcpp
	PR preprocessor/32974:
	* directives.c (parse_include): Don't check for EOL when
	processing #pragma dependency.

From-SVN: r127614
2007-08-18 17:54:11 +00:00
Ollie Wild ccfc4c91bb directives-only.c: New file.
libcpp/
	* directives-only.c: New file.
	* internal.h (struct _cpp_dir_only_callbacks): New.
	(_cpp_preprocess_dir_only): New function.
	* directives.c (_cpp_handle_directive): Check directives_only before
	disabling execution of indented directives.
	* files.c (_cpp_stack_file): Add directives_only check.
	* include/cpplib.h (struct cpp_options): Add directives_only.
	(cpp_init_special_builtins): New function.
	* init.c (cpp_init_special_builtins): New function.
	(cpp_init_builtins): Move builtin_array initialization to
	cpp_init_special_builtins.
	(post_options): Check directives_only before setting
	pfile->state.prevent_expansion = 1.
	* macro.c (_cpp_builtin_macro_text): Print an error if __COUNTER__
	is expanded inside a directive while -fdirectives-only is enabled.
	* Makefile.in (libcpp_a_OBJS): Add directives-only.o.
	(libcpp_a_SOURCES): Add directives-only.c.

	gcc/
	* c-ppoutput.c (print_lines_directives_only): New function.
	(scan_translation_unit_directives_only): New function.
	(preprocess_file): Add call to scan_translation_unit_directives_only.
	* c-opts.c (c_common_handle_option): Add OPT_fdirectives_only.
	(sanitize_cpp_opts): Add default flag_dump_macros setting for
	-fdirectives-only.  Add errors for -fdirectives-only conflict with
	-Wunused-macros and -traditional.
	(finish_options): Add builtin macro initialization for
	-fdirectives-only + -fpreprocessed.
	* c.opt (fdirectives-only): New.
	* doc/cppopts.texi (fdirectives-only): New.

	gcc/testsuite/
	* gcc.dg/cpp/counter-2.c: New test.
	* gcc.dg/cpp/counter-3.c: New test.
	* gcc.dg/cpp/dir-only-1.c: New test.
	* gcc.dg/cpp/dir-only-1.h: New file.
	* gcc.dg/cpp/dir-only-2.c: New test.
	* gcc.dg/cpp/dir-only-3.c: New test.
	* gcc.dg/cpp/dir-only-3a.h: New file.
	* gcc.dg/cpp/dir-only-3b.h: New file.
	* gcc.dg/cpp/dir-only-4.c: New test.
	* gcc.dg/cpp/dir-only-5.c: New test.
	* gcc.dg/cpp/dir-only-6.c: New test.

From-SVN: r127066
2007-07-30 18:29:20 +00:00
Uros Bizjak a206413ab4 traditional.c (_cpp_scan_out_logical_line): Initialize fmacro.args...
* traditional.c (_cpp_scan_out_logical_line): Initialize
	fmacro.args, fmacro.node, fmacro.offset, fmacro.line and
	fmacro.args to prevent 'may be used uninitialized' warning.

From-SVN: r126311
2007-07-04 12:08:44 +02: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
Danny Smith e1311401df Correct filename of files.c in recent Changelog entries.
From-SVN: r125779
2007-06-17 23:19:09 +00:00
Danny Smith 66938a1d5d cppfiles.c (open_file): Correct typo.
* cppfiles.c (open_file): Correct typo.

From-SVN: r125778
2007-06-17 23:15:58 +00:00
Vladimir Prus 71995ede98 cppfiles.c (open_file): Prevent the call for stat from overwriting errno.
* cppfiles.c (open_file): Prevent the call
        for stat from overwriting errno.

From-SVN: r125757
2007-06-16 12:30:49 +00:00
Vladimir Prus 84152c25a5 cppfiles.c (open_file): Account for the fact that on windows, opening a directory gives EACCES.
* cppfiles.c (open_file): Account for the
        fact that on windows, opening a directory gives
        EACCES.

From-SVN: r125590
2007-06-09 10:16:52 +00: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
Dave Korn ed0e74e0a6 re PR preprocessor/14331 (please add option to suppress warning message "no newline at end of file")
2007-05-31  Dave Korn  <dave.korn@artimi.com>

        PR preprocessor/14331
        * lex.c (_cpp_get_fresh_line):  Don't warn if no newline at EOF.

From-SVN: r125212
2007-05-31 02:06:48 +00:00
Ollie Wild a702045a24 macro.c (_cpp_builtin_macro_text): Handle BT_COUNTER.
* macro.c (_cpp_builtin_macro_text): Handle BT_COUNTER.
	* pch.c (cpp_write_pch_deps): Save __COUNTER__ state.
	(cpp_write_pch_state): Save __COUNTER__ state.
	(cpp_valid_state): Check valid __COUNTER__ state.
	(cpp_read_state): Read new __COUNTER__ state.
	* include/cpplib.h (enum builtin_type): Add BT_COUNTER enumerator.
	* init.c (builtin_array): Add __COUNTER__/BT_COUNTER.
	* internal.h (struct cpp_reader): Add counter member.

	* gcc.dg/cpp/counter-1.c: New test.
	* gcc.dg/pch/counter-1.c: New test.
	* gcc.dg/pch/counter-1.hs: New file.
	* gcc.dg/pch/counter-2.c: New test.
	* gcc.dg/pch/counter-2.hs: New file.
	* gcc.dg/pch/counter-3.c: New test.
	* gcc.dg/pch/counter-3.hs: New file.

	* doc/cpp.texi (Common Predefined Macros): Add __COUNTER__
	description.

From-SVN: r125041
2007-05-24 20:55:36 +00:00
Simon Martin 126e073b22 re PR preprocessor/20077 (GCC accepts macro definitions that fail a constraint)
2007-05-23  Simon Martin  <simartin@users.sourceforge.net>

	PR preprocessor/20077
	* macro.c (create_iso_definition): Fixed the method to determine whether
	the token-pasting operator appears at the beginning or the end of a macro.

From-SVN: r125000
2007-05-23 20:58:34 +00:00
Ian Lance Taylor 0b4cafec04 internal.h (struct cpp_reader): Add new fields: nonexistent_file_hash and nonexistent_file_ob.
* internal.h (struct cpp_reader): Add new fields:
	nonexistent_file_hash and nonexistent_file_ob.
	* files.c: Include "obstack.h".
	(find_file_in_dir): Before trying to open the file, look up the
	path name in the hash table of nonexistent files.  After failing
	to open the file, add the path name to the hash table.
	(_cpp_find_file): Cache the results of looking up the file name
	starting with the quote and bracket chain heads, if we can.
	(nonexistent_file_hash_eq): New static function.
	(_cpp_init_files): Initialize pfile->nonexistent_file_hash and
	pfile->nonexistent_file_ob.
	(_cpp_cleanup_files): Free pfile->nonexistent_file_hash and
	pfile->nonexistent_file_ob.

From-SVN: r124929
2007-05-21 23:43:53 +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
Tom Tromey fca35e1b54 re PR preprocessor/28709 (Bad diagnostic pasting tokens with ##)
libcpp
	PR preprocessor/28709:
	* macro.c (paste_tokens): Remove PASTE_LEFT from the old lhs.
gcc/testsuite
	PR preprocessor/28709:
	* gcc.dg/cpp/pr28709.c: New file.

From-SVN: r124356
2007-05-02 19:33:44 +00:00
Michael Meissner 4cd97075ff make alloca call type correct
From-SVN: r123374
2007-03-30 22:40:19 +00:00
Richard Henderson 121de39fc0 directives.c (lex_macro_node_from_str): New.
libcpp/
        * directives.c (lex_macro_node_from_str): New.
        (cpp_push_definition, cpp_pop_definition): New.
        * include/cpplib.h (cpp_push_definition, cpp_pop_definition): Declare.
gcc/
        * c-pragma.c (struct def_pragma_macro_value): New.
        (struct def_pragma_macro): New.
        (pushed_macro_table): New.
        (dpm_hash, dpm_eq): New.
        (handle_pragma_push_macro, handle_pragma_pop_macro): New.
        (init_pragma): Install them.
        * doc/tm.texi (HANDLE_PRAGMA_PUSH_POP_MACRO): New.

Co-Authored-By: Kai Tietz <kai.tietz@onevision.com>

From-SVN: r123370
2007-03-30 14:12:53 -07:00