Commit Graph

243 Commits

Author SHA1 Message Date
Neil Booth
ba57a9c052 cppinit.c (cpp_handle_option): Suppress warnings with an implicit "-w" for "-M" and "-MM".
* cppinit.c (cpp_handle_option):  Suppress warnings with an
	implicit "-w" for "-M" and "-MM".

From-SVN: r55195
2002-07-02 22:28:18 +00:00
Neil Booth
278c466207 cpphash.h (struct cpp_reader): Make date and time strings.
* cpphash.h (struct cpp_reader): Make date and time strings.
	(_cpp_builtin_macro_text, _cpp_copy_replacement_text,
	_cpp_replacement_text_len): New.
	* cppinit.c (cpp_create_reader): Update.
	(init_builtins): Register appropriate builtins for -traditional-cpp.
	* cppmacro.c (new_number_token): Remove.
	(_cpp_builtin_macro_text): New.
	(builtin_macro): Use it.
	(cpp_macro_definition): Update to handle traditional macros.
	* cppmain.c (cb_line_change): Don't do column positioning for
	traditional output.
	* cpptrad.c (enum ls): Rename ls_fun_macro to ls_fun_open.  New
	state ls_fun_close.
	(skip_whitespace): Fix.
	(maybe_start_funlike): Don't set state.parsing_args.
	(scan_out_logical_line): Remove duplicate error.  Use lex_state
	rather than state.parsing_args.
	(push_replacement_text): Handle builtins.
	(_cpp_replacement_text_len, _cpp_copy_replacement_text): New.

From-SVN: r54771
2002-06-19 05:40:08 +00:00
Neil Booth
1a76916c78 Makefile.in: Update cppmain.o.
* Makefile.in: Update cppmain.o.
	* cpphash.h (struct cpp_reader): Move some members to a
	nested structure.
	(trad_line): Rename saved_line.
	(_cpp_read_logical_line_trad): Update.
	(_cpp_remove_overlay): New.
	* cppinit.c (cpp_create_reader): No need to set saved_line.
	(cpp_destroy): Update.
	(cpp_read_main_file): Only overlay if compiling.
	* cpplex.c (continue_after_nul): Return false if in directive.
	* cpplib.c (EXPAND): New.
	(directive_table, SEEN_EOL): Update.
	(end_directive): Remove overlay if traditional; don't skip
	line in traditional #define.
	(prepare_directive_trad): New.
	(_cpp_handle_directive, run_directive): Update for traditional
	directives.
	(lex_macro_node): Simplify, don't use lex_identifier_trad.
	* cpplib.h (struct options): Add preprocess_only.
	* cppmain.c: Don't include intl.h.
	(cpp_preprocess_file): Set options->preprocess_only.
	(scan_translation_unit_trad): Fix, and print line numbers.
	* cpptrad.c (check_output_buffer, lex_identifier, scan_parameters,
	maybe_start_funlike, scan_out_logical_line, replace_args_and_push,
	save_replacement_text, _cpp_create_trad_definition): Update for
	variable renaming.
	(_cpp_overlay_buffer): Save line number.
	(_cpp_remove_overlay): Rename from restore_buff, restore line.
	(_cpp_read_logical_line_trad): Don't handle overlays here.
	(scan_out_logical_line): Process directives.

From-SVN: r54485
2002-06-11 05:36:17 +00:00
Zack Weinberg
5a9ee62387 Makefile.in (LIBCPP_OBJS): Take out version.o.
* Makefile.in (LIBCPP_OBJS): Take out version.o.
	* cpphash.h (cpp_reader): Take out print_version member.
	* cppinit.c: (cpp_handle_option): Don't do anything with
	-version.  Just set help_only for --version, --target-help.
	Just set verbose option for -v.
	(cpp_post_options): Don't print a version string.

From-SVN: r54390
2002-06-09 00:26:31 +00:00
Zack Weinberg
09e77dee59 cppinit.c (COMMAND_LINE_OPTIONS): Give all relevant -W options their own entries.
* cppinit.c (COMMAND_LINE_OPTIONS): Give all relevant -W
	options their own entries.
	(parse_option): Clarify comment.
	(cpp_handle_option): Remove 'ignore' parameter and OPT_W
	special case.  Replace if/strcmp chain for -W options with
	use of new OPT_* entries for them.
	(cpp_handle_options): Update to match.
	* cpplib.h: Remove last parameter to cpp_handle_option from prototype.
	* c-decl.c, cp/decl2.c: Update call to cpp_handle_option.

From-SVN: r54352
2002-06-07 22:24:30 +00:00
Neil Booth
cbc69f844e cpphash.h (_cpp_create_definition): Update prototype.
* cpphash.h (_cpp_create_definition): Update prototype.
	(_cpp_push_text_context, _cpp_create_trad_definition): New.
	( cpp_lex_identifier_trad): New.
	(_cpp_set_trad_context): New.
	* cppinit.c (cpp_finish_options): Don't conditionalize builtins.
	* cpplib.c (SEEN_EOL): Update.
	(lex_macro_node): Update for -traditional.
	(cpp_push_buffer, _cpp_pop_buffer): Similarly.
	* cppmacro.c (_cpp_create_definition): Split into
	create_iso_definition() and _cpp_create_trad_definition().
	(warn_of_redefinition): Update prototype; handle traditional
	macros.
	(_cpp_push_text_context): New.
	* cpptrad.c (skip_whitespace, push_replacement_text): New.
	(lex_identifier): Call ht_lookup with correct start.
	(_cpp_lex_identifier_tradm _cpp_create_trad_definition,
	_cpp_set_trad_context): New.
	(scan_out_logical_line): Update to handle changing contexts.

From-SVN: r54293
2002-06-05 20:27:12 +00:00
Neil Booth
ceeedfc11a c-common.c (c_common_init): Override cpplib's default warn_long_long setting.
* c-common.c (c_common_init): Override cpplib's default
	warn_long_long setting.
	* c-lex.c (lex_number): Replace with interpret_integer,
	interpret_float, narrowest_unsigned_type and
	narrowest_signed_type, taking advantage of the new
	cpplib functionality.
	* cpperror.c (_cpp_begin_message): If a warning is turned
	into an error, avoid printing "warning:".
	* cppexp.c (cpp_num_sign_extend): New.
	* cppinit.c: Update comment.
	* cpplib.h (cpp_num_sign_extend): New.
	* tree.h: Update comment.
testsuite:
	* gcc.dg/wtr-int-type-1.c, gcc.dg/wtr-suffix-1.c,
	gcc.dg/cpp/paste4.c, gcc.dg/cpp/sysmac2.c:
	Update for mofified diagnostics.
	* gcc.dg/c99-intconst-1.c: No longer fail.

From-SVN: r54180
2002-06-02 19:37:34 +00:00
Zack Weinberg
39e5db1a7c cppinit.c (append_include_chain): Always pay attention to cxx_aware when setting new->sysp.
* cppinit.c (append_include_chain): Always pay attention to
	cxx_aware when setting new->sysp.  Remove ATTRIBUTE_UNUSED
	marker on argument.

From-SVN: r54124
2002-05-31 22:57:55 +00:00
Neil Booth
cd7ab83f2d cppexp.c (cpp_num): Move to cpplib.h.
2002-05-29  Neil Booth  <neil@daikokuya.demon.co.uk>
	    Zack Weinberg <zack@codesourcery.com>

	* cppexp.c (cpp_num): Move to cpplib.h.
	(CPP_ERROR): Remove.
	(interpret_float_suffix, interpret_int_suffix): New.
	(struct suffix, vsuf_1, vsuf_2, vsuf_3): Remove.
	(cpp_classify_number, cpp_interpret_integer): New.
	(interpret_number): Remove.
	(eval_token): Update to use new routines.
	* cpphash.h (cpp_num_part): Move to cpplib.h.
	* cppinit.c (cpp_post_options): Set warn_long_long.
	* cpplib.h (struct cpp_options): Add warn_long_long.
	(cpp_num, cpp_num_part, CPP_N_CATEGORY, CPP_N_INVALID,
	CPP_N_INTEGER, CPP_N_FLOATING, CPP_N_WIDTH, CPP_N_SMALL,
	CPP_N_MEDIUM, CPP_N_LARGE, CPP_N_RADIX, CPP_N_DEC, CPP_N_HEX,
	CPP_N_OCTAL, CPP_N_UNSIGNED, CPP_N_IMAGINARY, cpp_classify_number,
	cpp_interpret_integer): New.
testsuite:
	* gcc.dg/cpp/c++98-pedantic.c, gcc.dg/cpp/c89-pedantic.c,
	gcc.dg/cpp/c94-pedantic.c, gcc.dg/cpp/gnuc89-pedantic.c,
	gcc.dg/cpp/if-1.c: Update for modified diagnostics.

Co-Authored-By: Zack Weinberg <zack@codesourcery.com>

From-SVN: r54007
2002-05-29 17:15:42 +00:00
Neil Booth
c9220e3a83 c-common.c (c_common_init): Set CPP arithmetic precision.
* c-common.c (c_common_init): Set CPP arithmetic precision.
	* cppexp.c (cpp_num_part): Move typedef ...
	* cpphash.h: ...here; make unsigned HOST_WIDE_INT.
	* cppinit.c (cpp_create_reader): Default to host long arithmetic.
	(sanity_checks): Update.
testsuite:
	* gcc.dg/cpp/arith-2.c, gcc.dg/cpp/arith-3.c: New tests.
	* gcc.dg/cpp/if-3.c: Remove.

From-SVN: r53911
2002-05-27 05:51:14 +00:00
Neil Booth
17645b154d cppinit.c (mark_named_operators): Split out from init_builtins.
* cppinit.c (mark_named_operators): Split out from init_builtins.
	(cpp_finish_options): Call it from here instead.
testsuite:
	* gcc.dg/cpp/named_ops.c: New test.

From-SVN: r53803
2002-05-23 18:55:27 +00:00
Neil Booth
bdee42b16c cpperror.c (_cpp_begin_message): No special casing of CPP_FATAL_LIMIT.
* cpperror.c (_cpp_begin_message): No special casing
	of CPP_FATAL_LIMIT.
	* cppinit.c (sanity_checks): s/DL_FATAL/DL_ICE/.
	(output_deps, cpp_handle_option, cpp_post_options): Use DL_ERROR.
	* cpplib.c (do_include_common): Use DL_ERROR.
	* cpplib.h (CPP_FATAL_LIMIT, CPP_FATAL_ERRORS, DL_FATAL): Remove.
	(DL_ICE): Renumber.
	* fix-header.c (read_scan_file): Update.

From-SVN: r53765
2002-05-23 06:07:45 +00:00
Kazu Hirata
df38348381 cpperror.c: Fix formatting.
* cpperror.c: Fix formatting.
	* cppexp.c: Likewise.
	* cppfiles.c: Likewise.
	* cpphash.c: Likewise.
	* cpphash.h: Likewise.
	* cppinit.c: Likewise.
	* cpplex.c: Likewise.
	* cpplib.c: Likewise.
	* cppmacro.c: Likewise.
	* cppmain.c: Likewise.
	* cppspec.c: Likewise.

From-SVN: r53751
2002-05-22 22:02:16 +00:00
Zack Weinberg
2a1dc0d87e c-common.c (c_common_init): Set options->unsigned_char from flag_signed_char.
* c-common.c (c_common_init): Set options->unsigned_char from
	flag_signed_char.
	(cb_register_builtins): Define __STRICT_ANSI__ and
	__CHAR_UNSIGNED__ here...
	* cppinit.c (init_builtins): Not here.
	(cpp_create_reader): unsigned_char option defaults to 0, not
	!DEFAULT_SIGNED_CHAR.
	(COMMAND_LINE_OPTIONS, cpp_handle_option): Lose -fsigned-char
	and -funsigned-char.

	* cpphash.h (struct spec_nodes): Kill n__STRICT_ANSI__.
	* cpphash.c (_cpp_init_hashtable): Don't set it.
	* cppmacro.c (builtin_macro) [BT_STDC]: Use the language setting
	directly.  Clarify comment.

From-SVN: r53703
2002-05-21 21:55:37 +00:00
Andreas Jaeger
68bd6dd688 * cppinit.c (sanity_checks): Avoid printf mismatch warnings.
From-SVN: r53694
2002-05-21 22:09:00 +02:00
Neil Booth
43612ffb67 cppinit.c (cpp_post_options): If preprocessed, turn off traditional.
* cppinit.c (cpp_post_options): If preprocessed, turn off
	traditional.  If traditional, turn off column numbers.
	* cpplib.c (cpp_push_buffer): Lex from stage 3 if traditional.
	* cpptrad.c (handle_newline): Update line_base.
	(skip_comment): Handle -Wcomment.

From-SVN: r53582
2002-05-18 08:23:20 +00:00
Zack Weinberg
f24a153ab2 cppinit.c (struct builtin): Remove unused fields.
* cppinit.c (struct builtin): Remove unused fields.
	(CPLUS, BUILTIN, OPERATOR, O, builtin_array_end): Kill.
	(operator_array): New - was second half of builtin_array.
	(init_builtins): Simplify loop over builtin_array/operator_array.

From-SVN: r53574
2002-05-18 00:43:13 +00:00
Neil Booth
004cb26351 Makefile.in: Update for cpptrad.c.
* Makefile.in: Update for cpptrad.c.
	* cpphash.h (struct cpp_buffer): New members for buffer
	overlays.
	(struct cpp_reader): New members for traditional output.
	(_cpp_read_logical_line, _cpp_overlay_buffer): New.
	* cppinit.c (cpp_create_reader): Set trad_line.
	(cpp_destroy): Free trad_out_base if used.
	(cpp_read_main_file): Overlay an empty buffer if traditional.
	(cpp_finish_options): Don't do builtins.
	(COMMAND_LINE_OPTIONS): Add -traditional-cpp.
	(cpp_handle_option): Handle it.
	* cpplex.c (continue_after_nul): New.
	(_cpp_lex_direct): Use handle_nul.
	* cpplib.h (struct cpp_options): New traditional option.
	* cpptrad.c: New file.

From-SVN: r53568
2002-05-17 20:16:48 +00:00
Neil Booth
bdcae02bc4 c-common.c (c_common_init_options): Use C89 for Objective-C, and set the options flag.
* c-common.c (c_common_init_options): Use C89 for Objective-C,
	and set the options flag.
	* cppinit.c (lang_flags): Remove objc.
	(lang_defaults): Remove OBJC and OBJCXX.
	(set_lang): Update.
	(COMMAND_LINE_OPTIONS): Remove -+ and -lang-objc++.
	(cpp_handle_option): Remove -+ and -lang-objc++.
	For ObjC, just set a flag.
	(print_help): Update.
	* cpplib.h (enum c_lang): Remove CLK_OBJC and CLK_OBJCXX.

From-SVN: r53566
2002-05-17 19:37:43 +00:00
Zack Weinberg
5279d7394e c-common.c (STDC_0_IN_SYSTEM_HEADERS, [...]): Default-define here.
* c-common.c (STDC_0_IN_SYSTEM_HEADERS, REGISTER_PREFIX):
	Default-define here.
	(builtin_define_with_value): Can now wrap the expansion in
	quotation marks if such is wanted.
	(cb_register_builtins): Update calls to	builtin_define_with_value.
	Define __REGISTER_PREFIX__, __USER_LABEL_PREFIX__, and __VERSION__
	here.
	(c_common_init): Set options->stdc_0_in_system_headers.
	* c-lex.h: Update prototype of builtin_define_with_value.
	* cppdefault.h: Remove default definitions of USER_LABEL_PREFIX
	and REGISTER_PREFIX.

	* cppinit.c (VERS, ULP, C, X): Kill.
	(builtin_array): Remove entries for __VERSION__,
	__USER_LABEL_PREFIX__, __REGISTER_PREFIX__, and
	__HAVE_BUILTIN_SETJMP__.  Make __STDC__ always a builtin, not
	a constant.
	(init_builtins): Kill off a bunch of now-dead code.
	(COMMAND_LINE_OPTIONS): Remove -fleading-underscore and
	-fno-leading-underscore.
	(cpp_handle_option): Remove code to set user_label_prefix.
	(cpp_post_options): Likewise.

	* cpplib.h (struct cpp_options): Remove user_label_prefix.
	(stdc_0_in_system_headers): New.
	* cppmacro.c (builtin_macro): Check CPP_OPTION (pfile,
	stdc_0_in_system_headers) too to decide the value of __STDC__.

	* tradcpp.c (user_label_prefix): Kill.
	(main): Remove code handling -f(no-)leading-underscore.
	(initialize_builtins): Don't define __REGISTER_PREFIX__
	or __USER_LABEL_PREFIX__.
	(install_value): Wrap compound statement in dummy loop so the
	macro works properly in an if statement.

From-SVN: r53525
2002-05-16 19:03:02 +00:00
Zack Weinberg
a11eba953e c-parse.in (MODIFIED_WCHAR_TYPE): New macro.
* c-parse.in (MODIFIED_WCHAR_TYPE): New macro.
	(c_common_nodes_and_builtins): Use it.
	(builtin_define_with_value): New function.
	(cb_register_builtins): Define __SIZE_TYPE__,
	__PTRDIFF_TYPE__, __WCHAR_TYPE__, and __WINT_TYPE__ here,
	using builtin_define_with_value.  Use consistent notation when
	defining __GXX_WEAK__.
	(WCHAR_TYPE_SIZE): Don't redefine.
	(combine_strings): Don't use WCHAR_TYPE_SIZE.

	* cppdefault.h: Don't provide defaults for SIZE_TYPE,
	PTRDIFF_TYPE, WCHAR_TYPE, or WINT_TYPE.
	* cppinit.c (builtin_array): Remove entries for __SIZE_TYPE__ etc.
	* tradcpp.c (initialize_builtins): Likewise.
	* gcc.c (cpp_unique_options): Don't muck with __WCHAR_TYPE__.

	* c-lex.h (builtin_define_with_value): Prototype.
	* system.h: Poison NO_BUILTIN_SIZE_TYPE, NO_BUILTIN_WCHAR_TYPE,
	NO_BUILTIN_PTRDIFF_TYPE, and NO_BUILTIN_WINT_TYPE.
	* doc/tm.texi: Remove mention of NO_BUILTIN_SIZE_TYPE etc.

	* config/avr/avr.h, config/h8300/h8300.h, config/i386/i386.h,
	config/ia64/ia64.h, config/mips/dec-osf1.h, config/mips/iris6.h,
	config/mips/linux.h, config/mips/mips.h, config/mips/netbsd.h,
	config/mips/osfrose.h, config/mips/sni-svr4.h, config/rs6000/aix51.h,
	config/s390/linux.h, config/sh/sh.h, config/sh/sh64.h,
	config/sparc/linux64.h, config/sparc/netbsd-elf.h,
	config/sparc/sol2-bi.h, config/sparc/sparc.h:
	Do not define NO_BUILTIN_SIZE_TYPE etc.  Remove all references
	to __SIZE_TYPE__ etc from all spec strings. When this makes
	extra specs empty, delete them.

From-SVN: r53472
2002-05-15 05:30:01 +00:00
Neil Booth
12a41c224d Makefile.in (c-common.o, cppinit.o): Update.
* Makefile.in (c-common.o, cppinit.o): Update.
	* c-common.c: Include except.h.
	(cb_register_builtins): Handle __USING_SJLJ_EXCEPTIONS__.
	Call TARGET_CPU_CPP_BUILTINS and TARGET_OS_CPP_BUILTINS.
	* cppinit.c (__USING_SJLJ_EXCEPTIONS): Not here.
	* defaults.h (TARGET_OS_CPP_BUILTINS, TARGET_CPU_CPP_BUILTINS,
	CPP_PREDEFINES): Handle here.
config:
	* alpha/alpha-interix.h, alpha/gnu.h, alpha/linux.h,
	alpha/netbsd.h, alpha/openbsd.h, alpha/osf.h, alpha/unicosmk.h,
	alpha/vms.h, alpha/vxworks.h: Remove CPP_PREDEFINES, define
	TARGET_OS_CPP_BUILTINS.
	* alpha/alpha.h (TARGET_CPU_CPP_BUILTINS): Define.
	(CPP_SPEC, EXTRA_SPECS): Update.
	(CPP_AM_BWX_SPEC, CPP_AM_MAX_SPEC, CPP_AM_FIX_SPEC,
	CPP_AM_CIX_SPEC, CPP_IM_EV4_SPEC, CPP_IM_EV5_SPEC,
	CPP_IM_EV6_SPEC, CPP_CPU_EV4_SPEC, CPP_CPU_EV5_SPEC,
	CPP_CPU_EV56_SPEC, CPP_CPU_PCA56_SPEC, CPP_CPU_EV6_SPEC,
	CPP_CPU_EV67_SPEC, CPP_CPU_DEFAULT_SPEC, CPP_CPU_SPEC): Remove.
doc:
	* tm.texi (TARGET_REGISTER_CPP_BUILTINS): Remove.
	(TARGET_OS_CPP_BUILTINS, TARGET_CPU_CPP_BUILTINS): Define.

From-SVN: r53410
2002-05-13 05:57:38 +00:00
Neil Booth
44a147ad2e c-common.c (c_common_init): Set options->unsigned_wchar.
* c-common.c (c_common_init): Set options->unsigned_wchar.
	* cppinit.c (cpp_create_reader): Default unsigned_wchar,
	group target dependencies.
	(init_builtins, cpp_handle_option): Update.
	* cpplex.c (cpp_interpret_charconst): Update.
	* cpplib.h (struct cpp_options): Add unsigned_wchar, rename
	signed_char to unsigned_char, group target dependencies.
	* defaults.h (WCHAR_UNSIGNED): Remove.
	* system.h (WCHAR_UNSIGNED, MAX_CHAR_TYPE_SIZE): Poison.
config:
	* freebsd.h, interix.h, alpha/freebsd.h, arm/freebsd.h,
	i386/386bsd.h, i386/beos-elf.h, i386/bsd386.h, i386/cygwin.h,
	i386/djgpp.h, i386/freebsd-aout.h, i386/i386-interix.h,
	i386/win32.h, ia64/freebsd.h, mips/netbsd.h, rs6000/freebsd.h,
	sh/elf.h, sh/sh.h, sparc/freebsd.h: Remove WCHAR_UNSIGNED.
doc:
	* tm.texi: Remove MAX_CHAR_TYPE_SIZE.

From-SVN: r53271
2002-05-07 21:07:24 +00:00
Neil Booth
a5a49440f7 c-common.c (warn_multichar): New.
* c-common.c (warn_multichar): New.
	(c_common_init): Set CPP's warn_multichar.
	* c-common.h (warn_multichar): New.
	* c-decl.c (warn_multichar): Remove.
	* c-lex.c (lex_charconst): Update.
	* c-tree.h (warn_multichar): Remove.
	* cppexp.c (eval_token): Sign-extend charconst value.
	* cppinit.c (cpp_create_reader): Set warn_multichar.
	* cpplex.c (cpp_interpret_charconst): Don't sign-extend
	each character.  Update prototype.  Sign-extend the result.
	* cpplib.h: Fix conditions.
	(struct cpp_options): Add new warning flag.
	(cpp_interpret_charconst): Update prototype.
cp:
	* Make-lang.in (decl2.o): Update.
	* cp-tree.h (warn_multichar): Remove.
	* decl2.c: Include c-common.h.
	(warn_multichar): Remove.
doc:
	* cpp.texi: Update documentation.
testsuite:
	* gcc.dg/cpp/charconst-3.c: Correct tests accordingly.

From-SVN: r53240
2002-05-06 22:53:10 +00:00
Neil Booth
2443d4e110 c-common.c (c_common_init): Set up CPP arithmetic.
* c-common.c (c_common_init): Set up CPP arithmetic.
	* cppinit.c (cpp_create_reader): Default CPP arithmetic to
	something reasonable for the host.
	(sanity_checks): Add checks.
	(cpp_read_main_file): Call sanity_checks() from here...
	(cpp_post_options): ... not here.
	* cpplex.c (cpp_interpret_charconst): Get max_chars right.
	* cpplib.h (struct cpp_options): New member int_precision.
testsuite:
	* gcc.dg/cpp/charconst.c: Update tests.

From-SVN: r53186
2002-05-05 17:05:09 +00:00
Neil Booth
3d90d2908e Makefile.in (c-lex.o): Update.
* Makefile.in (c-lex.o): Update.
	* c-lex.c: Include target.h.
	(cb_register_builtins): New.
	(init_c_lex): Set builtins callback.
	* c-lex.h (cpp_define, cpp_assert): New prototypes.
	* cppinit.c (init_builtins): Use callback, including for
	GXX_WEAK.
	* cpplib.h (struct cpp_callbacks): New member.
	* target-def.h (TARGET_REGISTER_CPP_BUILTINS): New.
	(TARGET_INITIALIZER): Update.
	* target.h (struct gcc_target): New hook.
	* tree.c (default_register_cpp_builtins): New.
	* tree.h (default_register_cpp_builtins): New.
doc:
	* tm.texi (TARGET_REGISTER_CPP_BUILTINS): Document.

From-SVN: r53165
2002-05-04 20:15:00 +00:00
Neil Booth
625458d0b9 cppinit.c (MAX_WCHAR_TYPE_SIZE): Move to cpplib.h
* cppinit.c (MAX_WCHAR_TYPE_SIZE): Move to cpplib.h
	(cpp_post_options): Move sanity checks to...
	(sanity_checks): New.
	* cpplex.c (maybe_read_ucs): Fix prototype.
	(parse_string, cpp_parse_escape): Cast for %c format specifier.
	* cpplib.h (cppchar_t): Use unsigned long or unsigned long long
	if necessary.

From-SVN: r53163
2002-05-04 19:42:01 +00:00
Neil Booth
4268e8bb94 c-lex.c (lex_string): Let cpp_parse_escape handles truncation and sign-extension.
* c-lex.c (lex_string): Let cpp_parse_escape handles truncation
	and sign-extension.
	(lex_charconst): Update for change in prototype of
	cpp_interpret_charconst.  Extend from cppchar_t to HOST_WIDE_INT
	appropriately.
	* cpphash.h (BITS_PER_CPPCHAR_T): New.
	* cppinit.c (cpp_create_reader): Initialize them for no
	change in semantics.
	(cpp_post_options): Add sanity checks.
	* cpplex.c (cpp_parse_escape): Handle precision, sign-extension
	and truncation issues.  Calculate in type cppchar_t.
	(MAX_CHAR_TYPE_SIZE, MAX_WCHAR_TYPE_SIZE): Remove.
	(cpp_interpret_charconst): Calculate in type cppchar_t.  Handle
	run-time dependent precision correctly.  Return whether the
	result is signed or not.
	* cpplib.c (dequote_string): Use cppchar_t; update.
	* cpplib.h (cppchar_signed_t): New.
	struct cpp_options): New precision members.
	(cpp_interpret_charconst, cpp_parse_escape): Update prototypes.

From-SVN: r53152
2002-05-04 07:30:32 +00:00
Jakub Jelinek
1651cc96a4 cppinit.c (cpp_handle_option): Don't set no_output here...
* cppinit.c (cpp_handle_option) [-dM]: Don't set no_output here...
	(cpp_post_options): ...but here.  Disable -dD, -dN and -dI when
	-M -or -MM is in effect.

From-SVN: r53013
2002-05-01 22:07:36 +02:00
Neil Booth
87ed109f1f cppexp.c (lex): Update to use state.skip_eval.
* cppexp.c (lex): Update to use state.skip_eval.
	(struct op): Remove prio and flags members.
	(FLAG_BITS, FLAG_MASK, PRIO_SHIFT, EXTRACT_PRIO, EXTRACT_FLAGS,
	SHORT_CIRCUIT, RIGHT_ASSOC, ..._PRIO, op_to_prio): Remove.
	(LEFT_ASSOC): New macro.
	(optab): New table of operator priorities and flags.
	(SHIFT): Update.
	(_cpp_parse_expr): Clean up logic.  Return bool.  Use a
	malloc-ed parser stack.
	(reduce): New; reduce the operator stack.
	(_cpp_expand_op_stack): Expand the operator stack as necessary.
	* cpphash.h (struct op): Predeclare.
	(struct cpp_reader): New members op_stack, op_limit.
	(struct lexer_state): New member skip_eval.
	(_cpp_parse_expr): Update.
	(_cpp_expand_op_stack): New.
	* cpplib.c (do_if): Update.
	* cppinit.c (cpp_create_reader): Create op stack.
	(cpp_destroy): And destroy it.
	* cpplib.h (CPP_LAST_CPP_OP): Correct.
	(TTYPE_TABLE): Correct.
testsuite:
	* gcc.dg/cpp/if-mop.c: Update.
	* gcc.dg/cpp/if-mpar.c: Add test.
	* gcc.dg/cpp/if-oppr.c: Update.

From-SVN: r52853
2002-04-28 19:42:54 +00:00
Neil Booth
af0d16cdec cppfiles.c (_cpp_pop_file_buffer): Return void.
* cppfiles.c (_cpp_pop_file_buffer): Return void.  Move
	file change and include code to _cpp_pop_buffer.
	* cpphash.h (struct pending_option): Predeclare.
	(struct cpp_reader): New member next_include_file.
	(_cpp_pop_file_buffer): Update.
	(_cpp_push_next_buffer): Update, rename.
	* cppinit.c (cpp_destroy): Free include chain and pending here.
	(cpp_finish_options): Simplify.
	(_cpp_push_next_buffer): Rename and clean up.
	* cpplib.c (cpp_pop_buffer): Move code from _cpp_pop_file_buffer.
	Clarify.
	* cppmacro.c (cpp_scan_nooutput): Set return_at_eof here.

From-SVN: r52621
2002-04-22 17:48:02 +00:00
Neil Booth
562a5c27c2 cppexp.c (struct op, [...]): Replace U_CHAR with uchar.
* cppexp.c (struct op, parse_number): Replace U_CHAR with uchar.
	* cppfiles.c (read_include_file): Similarly.
	* cpphash.h (DSC, U_CHAR, ustrcmp, ustrncmp, ustrlen,
	uxstrdup ustrchr, ufputs): Similarly.
	* cppinit.c (TRIGRAPH_MAP, cpp_destroy): Similarly.
	* cpplex.c (parse_slow, unescaped_terminator_p, save_comment,
	cpp_ideq, parse_identifier, parse_number): Similarly.
	* cpplib.c (struct directive, dequote_string, D, run_directive,
	cpp_push_buffer): Similarly.
	* cppmacro.c (new_string_token, builtin_macro, cpp_quote_string,
	_cpp_create_definition, check_trad_stringification,
	cpp_macro_definition): Similarly.

From-SVN: r52587
2002-04-21 18:46:42 +00:00
Neil Booth
ebef4e8ca7 cpperror.c (print_location): Don't print include chain if line == 0.
* cpperror.c (print_location): Don't print include chain
	if line == 0.
	(cpp_begin_message): Update to use DL_ macros.
	(cpp_ice, cpp_fatal, cpp_error_from_errno, cpp_warning,
	cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line,
	cpp_notice, cpp_notice_from_errno): Remove.
	(cpp_error, cpp_error_with_line): Update to take a diagnostic
	level.
	(cpp_errno): New.
	* cppexp.c (CPP_ICE): Remove.
	(SYNTAX_ERROR, SYNTAX_ERROR2, parse_number, parse_defined,
	lex, integer_overflow, _cpp_parse_expr): Update.
	* cppfiles.c (read_include_file, find_include_file,
	handle_missing_header, _cpp_read_file, remap_filename): Update.
	* cpphash.h (enum error_type): Remove.
	(_cpp_begin_message): Update.
	* cppinit.c (append_include_chain, remove_dup_dirs, output_deps,
	cpp_handle_option, cpp_post_options): Update.
	* cpplex.c (trigraph_p, skip_escaped_newlines, skip_block_comment,
	skip_whitespace, parse_identifier, parse_slow, parse_string,
	_cpp_lex_direct, cpp_spell_token, maybe_read_ucs, cpp_parse_escape,
	cpp_interpret_charconst): Update.
	* cpplib.c (check_eol, directive_diagnostics, _cpp_handle_directive,
	lex_macro_node, do_undef, glue_header_name, parse_include,
	do_include_common, read_flag, do_line, do_linemarker, do_ident,
	cpp_register_pragma, do_pragma_once, do_pragma_system_header,
	do_pragma_poison, do_pragma_dependency, _cpp_do__Pragma, do_else,
	do_elif, do_endif, parse_answer, parse_assertion, do_assert,
	_cpp_pop_buffer, do_diagnostic): Update.
	* cpplib.h (DL_WARNING, DL_WARNING_SYSHDR, DL_PEDWARN, DL_ERROR,
	DL_FATAL, DL_ICE, DL_EXTRACT, DL_WARNING_P): New.
	(cpp_ice, cpp_fatal, cpp_error_from_errno, cpp_warning,
	cpp_warning_with_line, cpp_pedwarn, cpp_pedwarn_with_line,
	cpp_notice, cpp_notice_from_errno): Remove.
	(cpp_error, cpp_error_with_line): Update to take a diagnostic
	level.
	(cpp_errno): New.
	* cppmacro.c (builtin_macro, stringify_arg, paste_all_tokens,
	collect_args, enter_macro_context, save_parameter, parse_params,
	_cpp_create_definition, check_trad_stringification,
	cpp_macro_definition): Update.
	* cppmain.c (cpp_preprocess_file): Update.
	* fix-header.c (read_scan_file): Update.

From-SVN: r52302
2002-04-14 18:42:47 +00:00
Jason Thorpe
477cdac754 cppinit.c (cpp_create_reader): Initialize discard_comments_in_macro_exp.
* cppinit.c (cpp_create_reader): Initialize
discard_comments_in_macro_exp.
(COMMAND_LINE_OPTIONS): Add "-CC" option.
(cpp_handle_option): Handle "-CC" option.
* cpplex.c (save_comment): If saving a C++ comment in
a directive, convert it to a C comment.
(_cpp_lex_direct): Pass second comment start character to
save_comment to indicate comment type.
* cpplib.c (_cpp_handle_directive): If processing
a "#define" directive and discard_comments_in_macro_exp
is false,  re-enable saving of comments.
(lex_macro_node): If discard_comments_in_macro_exp is false,
discard any comments before the macro identifier.
* cpplib.h (struct cpp_options): Add discard_comments_in_macro_exp
member.
* cppmacro.c (cpp_get_token): If expanding a macro while
processing a directive, discard any comments we might encounter.
(parse_params): If discard_comments_in_macro_exp is false,
ignore comments in the macro parameter list.
* gcc.c (cpp_unique_options): Add "-CC" option.
(option_map): Map "--comments-in-macros" to "-CC".
* doc/cppopts.texi: Document "-CC" option.
* f/lang-specs.h: Add "-CC" option.
* testsuite/gcc.dg/cpp/maccom1.c: New test.
* testsuite/gcc.dg/cpp/maccom2.c: New test.
* testsuite/gcc.dg/cpp/maccom3.c: New test.
* testsuite/gcc.dg/cpp/maccom4.c: New test.
* testsuite/gcc.dg/cpp/maccom5.c: New test.
* testsuite/gcc.dg/cpp/maccom6.c: New test.

From-SVN: r51975
2002-04-07 03:12:23 +00:00
Neil Booth
3ddbb8a977 gcc.c (cpp_options): Pass -MD through as -MD not -M -MF.
preprocessor/3951
	* gcc.c (cpp_options): Pass -MD through as -MD not -M -MF.
	* cppinit.c (cpp_handle_option): Set no_ouput if -MD or -MMD.
	(init_dependency_output): Don't make no_output decision here.

From-SVN: r51272
2002-03-24 21:01:00 +00:00
Neil Booth
2784528c88 cppinit.c (cpp_handle_option): Set warn_endif_labels if -pedantic here...
* cppinit.c (cpp_handle_option): Set warn_endif_labels if
	-pedantic here...
	(cpp_post_options): ... not here.

From-SVN: r51258
2002-03-24 12:52:28 +00:00
Phil Edwards
909de5da19 cpplib.h (struct cpp_options): New member, warn_endif_labels.
2002-03-22  Phil Edwards  <pme@gcc.gnu.org>

	* cpplib.h (struct cpp_options):  New member, warn_endif_labels.
	* cppinit.c (cpp_create_reader):  On by default.
	(cpp_handle_option):  Handle -W[no-]endif-labels.
	(cpp_post_options):  Also enable if -pedantic.
	* cpplib.c (do_else):  Use it.
	(do_endif):  Likewise.
	* doc/cppopts.texi:  Document new option.
	* doc/invoke.texi:  Document new option.

From-SVN: r51190
2002-03-22 21:59:04 +00:00
Neil Booth
b3124fac9b * cppinit.c: Revert -MD removal.
From-SVN: r50884
2002-03-16 14:03:36 +00:00
Neil Booth
576786b00f cppinit.c (print_help): Display -MD and -MMD.
* cppinit.c (print_help): Display -MD and -MMD.
	Don't display usage string.  Update assertion syntax and
	typo.
	(COMMAND_LINE_OPTIONS): Remove OPT_MD, OPT_MMD.
	(cpp_handle_option): Update.

From-SVN: r50874
2002-03-16 10:57:28 +00:00
Neil Booth
32810ba3df re PR preprocessor/5899 (-M disables -dM)
PR preprocessor/5899
	* cppinit.c (init_dependency_output): Don't ignore -dM etc.

From-SVN: r50545
2002-03-10 21:10:21 +00:00
Kaveh R. Ghazi
ca7558fcc6 attribs.c (init_attributes, [...]): Use ARRAY_SIZE in lieu of explicit sizeof/sizeof.
* attribs.c (init_attributes, decl_attributes): Use ARRAY_SIZE in
	lieu of explicit sizeof/sizeof.
	* i386.c (override_options, ix86_init_mmx_sse_builtins,
	ix86_expand_builtin): Likewise.
	* mips.c (mips_add_gc_roots): Likewise.
	* mmix.c (mmix_output_condition): Likewise.
	* rs6000.c (rs6000_override_options, altivec_expand_builtin,
	altivec_init_builtins): Likewise.
	* sparc.c (mark_ultrasparc_pipeline_state): Likewise.
	* cppexp.c (Nsuff, parse_number): Likewise.
	* cppinit.c (builtin_array_end): Likewise.
	* gcc.c (n_default_compilers, process_command): Likewise.
	* genpreds.c (output_predicate_decls): Likewise.
	* ggc-page.c (NUM_EXTRA_ORDERS): Likewise.
	* lcm.c (N_ENTITIES): Likewise.
	* stor-layout.c (set_sizetype): Likewise.

ada:
	* utils.c (init_gnat_to_gnu, init_gigi_decls): Use ARRAY_SIZE in
	lieu of explicit sizeof/sizeof.

cp:
	* decl.c (cxx_init_decl_processing): Use ARRAY_SIZE in lieu of
	explicit sizeof/sizeof.
	* decl2.c (cxx_decode_option): Likewise.
	* lex.c (init_reswords, REDUCE_LENGTH, TOKEN_LENGTH): Likewise.

java:
	* class.c (init_class_processing): Use ARRAY_SIZE in lieu of
	explicit sizeof/sizeof.
	* decl.c (java_init_decl_processing): Likewise.
	* jcf-parse.c (init_jcf_parse): Likewise.
	* parse.y (init_src_parse): Likewise.

From-SVN: r50255
2002-03-03 14:07:39 +00:00
Neil Booth
ab8e22289c cppinit.c (output_deps): Correct test for stdout output.
* cppinit.c (output_deps): Correct test for stdout output.
	(init_dependency_output): Cure warning.

From-SVN: r49993
2002-02-23 13:42:40 +00:00
Neil Booth
56cd5b954e cppinit.c (init_dependency_output): Take deps output file from -o if none given with -MF.
* cppinit.c (init_dependency_output): Take deps output file
	from -o if none given with -MF.  Suppress normal output.
	* gcc.c (cpp_unique_options): Have -M and -MM imply -E.
	* doc/cpp.texi, doc/invoke.texi: Update.

From-SVN: r49892
2002-02-20 07:24:10 +00:00
Zack Weinberg
afb58288e4 cppinit.c (merge_include_chains): Check for brack being NULL before attempting to merge it with qtail.
* cppinit.c (merge_include_chains): Check for brack being
	NULL before attempting to merge it with qtail.

From-SVN: r49814
2002-02-17 02:54:20 +00:00
Neil Booth
0fef3fd0ea cpphash.h (struct spec_nodes): Remove n__CHAR_UNSIGNED__.
* cpphash.h (struct spec_nodes): Remove n__CHAR_UNSIGNED__.
	* cpphash.c (_cpp_init_hashtable): Similarly.
	* cppinit.c (cpp_create_reader): Default the signed_char flag.
	(init_builtins): Define __CHAR_UNSIGNED__ appropriately.
	(COMMAND_LINE_OPTIONS): Recognise -f{un,}signed-char.
	(cpp_handle_option): Handle the new options.
	* cpplex.c (cpp_interpret_charconst): Use new flag.
	* cpplib.h (struct cpp_options): New member signed_char.
	* gcc.c (cpp_unique_options): Remove %c spec and documentation.
	(cpp_options): Handle -fsigned-char and -funsigned-char.
	(static_specs): Remove signed_char_spec.
	(do_spec1): Don't handle %c.
	* system.h: Poison SIGNED_CHAR_SPEC.
	* tradcif.y (yylex): Use flag_signed_char.
	* tradcpp.h (flag_signed_char): New.
	* tradcpp.c (flag_signed_char): New.
	(main): Handle new command-line options.
	(initialize_builtins): Define __CHAR_UNSIGNED__ if appropriate.
config:
	* alpha/alpha.h (SIGNED_CHAR_SPEC): Remove.
	* avr/avr.h: Remove old comments.
	* i960/i960.h (CPP_SPEC): Pass -fsigned-char if -mic*.
	(CC1_SPEC): Pass -fsigned-char if -mic*.
	(SIGNED_CHAR_SPEC): Remove.
doc:
	* tm.texi (SIGNED_CHAR_SPEC): Remove documentation.
testsuite:
	* gcc.dg/cpp/uchar-1.c, uchar-2.c, uchar-3.c: New tests.

From-SVN: r49444
2002-02-02 18:56:37 +00:00
Jakub Jelinek
ffdeea47b9 re PR other/1502 (Nonexistent -W options not diagnosed)
PR other/1502:
	* cppinit.c (cpp_handle_option): Add ignore argument, if it is zero,
	don't ignore unrecognized -W* options.
	(cpp_handle_options): Pass 1 as last argument to cpp_handle_option.
	* cpplib.h (cpp_handle_option): Adjust prototype.
	* c-decl.c (c_decode_options): Pass 0 as last argument to
	cpp_handle_option.

	PR c/2896:
	* gcc.c (cpp_unique_options): Split from cpp_options.
	(cpp_options): Source cpp_unique_options.
	(default_compilers): Use cpp_unique_options instead of cpp_options
	when used together with cc1_options.
	(static_specs): Add cpp_unique_options.
	* objc/lang-specs.h: Use cpp_unique_options instead of cpp_options
	when used together with cc1_options.

	* decl2.c (cxx_decode_option): Pass 0 as last argument to
	cpp_handle_option.
	* lang-specs.h: Use cpp_unique_options instead of cpp_options
	when used together with cc1_options.

From-SVN: r49315
2002-01-29 13:09:37 +01:00
Zack Weinberg
0d24f4d131 Makefile.in (cs-tconfig.h): Don't depend on $(CONFIG_H) or except.h.
* Makefile.in (cs-tconfig.h): Don't depend on $(CONFIG_H) or
	except.h.  Remove commands to define USING_SJLJ_EXCEPTIONS.
	(cppinit.o): Depend on except.h.
	(gencheck.h, options.h, specs.h, s-gencheck, s-options,
	s-specs): New rules.

	* configure.in: Don't AC_DEFINE_UNQUOTED PACKAGE or VERSION.
	Don't create specs.h/options.h/gencheck.h here.  Remove
	unnecessary variable settings from last argument of AC_OUTPUT.
	* config.in, configure: Regenerate.
	* intl.c: Hardcode package name as "gcc".

	* cppinit.c: Include except.h.
	(builtin_array): Define __USING_SJLJ_EXCEPTIONS__ when
	appropriate.
	* unwind-dw2.c, unwind-sjlj.c, config/ia64/unwind-ia64.c:
	Use #if(n)def __USING_SJLJ_EXCEPTIONS, not #if
	(!)USING_SJLJ_EXCEPTIONS.
	* doc/cpp.texi: Document __USING_SJLJ_EXCEPTIONS__.

From-SVN: r48651
2002-01-08 19:03:20 +00:00
Neil Booth
5d8ebbd862 cpperror.c: Update comments and copyright.
* cpperror.c: Update comments and copyright.
	* cppexp.c, cppfiles.c, cpphash.c, cpphash.h, cppinit.c,
	cpplex.c, cpplib.c, cpplib.h, cppmacro.c, cppmain.c: Similarly.

From-SVN: r48522
2002-01-03 21:43:09 +00:00
Graham Stott
745b26b3c2 cppinit.c: Update copyright date.
* cppinit.c: Update copyright date.
        Don't include output.h
        * Makefile.in: Update copyright date.
        Update dependency.

From-SVN: r48490
2002-01-03 03:55:19 +00:00
Joseph Myers
b0287a9034 c-typeck.c, [...]: Use "built-in" and "bit-field" spellings in messages.
* c-typeck.c, config/i386/i386.h, config/mcore/mcore.h,
	config/ns32k/ns32k.h, config/rs6000/sysv4.h, fold-const.c,
	toplev.c, cppinit.c, cppmacro.c, gcc.c: Use "built-in" and
	"bit-field" spellings in messages.
	* po/gcc.pot: Regenerate.

ch:
	* expr.c: Use "built-in" spelling in messages.

From-SVN: r48048
2001-12-15 20:31:07 +00:00