summaryrefslogtreecommitdiffstats
path: root/libcpp/files.c
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright years in libcpp/rsandifo2014-01-021-1/+1
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206293 138bc75d-0d04-0410-961f-82ee72b054a4
* 2013-06-24 Dehao Chen <dehao@google.com>dehao2013-06-241-9/+17
| | | | | | | | * files.c (_cpp_stack_include): Fix the highest_location when header file is guarded by #ifndef and is included twice. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@200376 138bc75d-0d04-0410-961f-82ee72b054a4
* PR middle-end/56461jakub2013-03-061-6/+11
| | | | | | | | | | | | | | * internal.h (struct cpp_buffer): Add to_free field. (_cpp_pop_file_buffer): Add third argument. * files.c (_cpp_stack_file): Set buffer->to_free. (_cpp_pop_file_buffer): Add to_free argument. Free to_free if non-NULL, and if equal to file->buffer_start, also clear file->buffer{,_start,_valid}. * directives.c (_cpp_pop_buffer): Pass buffer->to_free to _cpp_pop_file_buffer. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@196497 138bc75d-0d04-0410-961f-82ee72b054a4
* PR middle-end/56461jakub2013-03-011-1/+4
| | | | | | | | | | * files.c (_cpp_save_file_entries): Free result at the end. * pch.c (cpp_string_free): New function. (cpp_save_state): Use it in htab_create call. (cpp_write_pch_deps): Free ss->defs. Destroy ss->definedhash. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@196394 138bc75d-0d04-0410-961f-82ee72b054a4
* * files.c (_cpp_find_file): If returning early, before storingjakub2013-02-281-13/+30
| | | | | | | | | something to *hash_slot and *hash_slot is NULL, call htab_clear_slot on it. Access *hash_slot using void * type rather than struct file_hash_entry * to avoid aliasing issues. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@196356 138bc75d-0d04-0410-961f-82ee72b054a4
* Update copyright years in libcpp.rsandifo2013-01-141-3/+1
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@195162 138bc75d-0d04-0410-961f-82ee72b054a4
* PR bootstrap/55380jakub2012-12-031-3/+7
| | | | | | | | | | | | | PR other/54691 * files.c (read_file_guts): Allocate extra 16 bytes instead of 1 byte at the end of buf. Pass size + 16 instead of size to _cpp_convert_input. * charset.c (_cpp_convert_input): Reallocate if there aren't at least 16 bytes beyond to.len in the buffer. Clear 16 bytes at to.text + to.len. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@194102 138bc75d-0d04-0410-961f-82ee72b054a4
* 2012-11-21 Steve Ellcey <sellcey@mips.com>sje2012-11-211-1/+2
| | | | | | | | PR pch/55399 * files.c (pch_open_file): Fix check for implicit_preinclude. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@193709 138bc75d-0d04-0410-961f-82ee72b054a4
* * include/cpplib.h (struct cpp_options): Add canonical_system_headers.simonb2012-11-161-1/+1
| | | | | | | | | | | | | | | | | | | | * files.c (find_file_in_dir): Call maybe_shorter_path() only if canonical_system_headers is set. * init.c (cpp_create_reader): Initialize canonical_system_headers. * configure.ac: Add new --enable-canonical-system-headers. * configure: Regenerate. * config.in: Regenerate. * doc/cppopts.texi: Document -f[no-]canonical-system-headers. * doc/install.texi: Document --enable-canonical-system-headers. * c.opt: Add f[no-]canonical-system-headers. * c-opts.c (c_common_handle_option): Handle OPT_fcanonical_system_headers. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@193569 138bc75d-0d04-0410-961f-82ee72b054a4
* gcc:jsm282012-10-231-7/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * config.gcc (*-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu): Use glibc-c.o in c_target_objs and cxx_target_objs. Use t-glibc in tmake_file. Set target_has_targetcm. (tilegx-*-linux*, tilepro-*-linux*): Append to c_target_objs and cxx_target_objs rather than overriding previous value. * config/glibc-c.c, config/t-glibc: New. * doc/tm.texi.in (TARGET_C_PREINCLUDE): New @hook. * doc/tm.texi: Regenerate. * hooks.c (hook_constcharptr_void_null): New. * hooks.h (hook_constcharptr_void_null): Declare. gcc/c-family: * c-common.h (pch_cpp_save_state): Declare. * c-target.def (c_preinclude): New hook. * c-opts.c (done_preinclude): New. (push_command_line_include): Handle default preincluded header. (cb_file_change): Call pch_cpp_save_state when calling push_command_line_include. * c-pch.c (pch_ready_to_save_cpp_state, pch_cpp_state_saved) (pch_cpp_save_state): New. (pch_init): Call pch_cpp_save_state conditionally, instead of calling cpp_save_state. gcc/testsuite: * gcc.dg/c99-predef-1.c: New test. * gcc.dg/cpp/cmdlne-dU-1.c, gcc.dg/cpp/cmdlne-dU-2.c, gcc.dg/cpp/cmdlne-dU-3.c, gcc.dg/cpp/cmdlne-dU-4.c, gcc.dg/cpp/cmdlne-dU-5.c, gcc.dg/cpp/cmdlne-dU-6.c, gcc.dg/cpp/cmdlne-dU-7.c, gcc.dg/cpp/cmdlne-dU-8.c, gcc.dg/cpp/cmdlne-dU-9.c, gcc.dg/cpp/cmdlne-dU-10.c, gcc.dg/cpp/cmdlne-dU-11.c, gcc.dg/cpp/cmdlne-dU-12.c, gcc.dg/cpp/cmdlne-dU-13.c, gcc.dg/cpp/cmdlne-dU-14.c, gcc.dg/cpp/cmdlne-dU-15.c, gcc.dg/cpp/cmdlne-dU-16.c, gcc.dg/cpp/cmdlne-dU-17.c, gcc.dg/cpp/cmdlne-dU-18.c, gcc.dg/cpp/cmdlne-dU-19.c, gcc.dg/cpp/cmdlne-dU-20.c, gcc.dg/cpp/cmdlne-dU-21.c, gcc.dg/cpp/cmdlne-dU-22.c, gcc.dg/cpp/mi5.c, gcc.dg/cpp/multiline.c: Add -nostdinc to dg-options. libcpp: * files.c (struct _cpp_file): Add implicit_preinclude. (pch_open_file): Allow a previously opened implicitly included file. (_cpp_find_file): Add implicit_preinclude argument. Free file and do not call open_file_failed if implicit_preinclude. Store implicit_preinclude value. (_cpp_stack_include, _cpp_fake_include, _cpp_compare_file_date): Update calls to _cpp_find_file. (_cpp_stack_include): Handle IT_DEFAULT. (cpp_push_default_include): New. * include/cpplib.h (cpp_push_default_include): Declare. * init.c (cpp_read_main_file): Update call to _cpp_find_file. * internal.h (enum include_type): Add IT_DEFAULT. (_cpp_find_file): Update prototype. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@192715 138bc75d-0d04-0410-961f-82ee72b054a4
* 2012-10-15 Tobias Burnus <burnus@net-b.de>burnus2012-10-151-0/+2
| | | | | | | | | | | | * files.c (read_file_guts, _cpp_save_file_entries): Free memory before returning. * lex.c (warn_about_normalization): Ditto. * mkdeps.c (deps_save): Ditto. * pch.c (cpp_valid_state): Ditto. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@192474 138bc75d-0d04-0410-961f-82ee72b054a4
* 2012-04-30 Manuel López-Ibáñez <manu@gcc.gnu.org>manu2012-04-301-1/+34
| | | | | | | | | | | Dodji Seketeli <dodji@seketeli.org> PR c++/52974 * libcpp/files.c (maybe_shorter_path): New. (find_file_in_dir): Use it. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@186991 138bc75d-0d04-0410-961f-82ee72b054a4
* libcpp/gfunck2012-01-091-2/+9
| | | | | | | | | | | | | | | | | | | PR preprocessor/33919 * files.c (_cpp_get_file_name): New. Implement file name access function. * internal.h (_cpp_get_file_name): New prototype. * macro.c (_cpp_builtin_macro_text): Call _cpp_get_file_name() to use pfile->main_file in lieu of traversing INCLUDED_FROM chain. gcc/testsuite/ PR preprocessor/33919 * gcc.dg/pr33919.c: New test. * gcc.dg/pr33919-0.h: New test header file. * gcc.dg/pr33919-1.h: Ditto. * gcc.dg/pr33919-2.h: Ditto. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@183003 138bc75d-0d04-0410-961f-82ee72b054a4
* Linemap infrastructure for virtual locationsdodji2011-10-171-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the first instalment of a set which goal is to track locations of tokens across macro expansions. Tom Tromey did the original work and attached the patch to PR preprocessor/7263. This opus is a derivative of that original work. This patch modifies the linemap module of libcpp to add virtual locations support. A virtual location is a mapped location that can resolve to several different physical locations. It can always resolve to the spelling location of a token. For tokens resulting from macro expansion it can resolve to: - either the location of the expansion point of the macro. - or the location of the token in the definition of the macro - or, if the token is an argument of a function-like macro, the location of the use of the matching macro parameter in the definition of the macro The patch creates a new type of line map called a macro map. For every single macro expansion, there is a macro map that generates a virtual location for every single resulting token of the expansion. The good old type of line map we all know is now called an ordinary map. That one still encodes spelling locations as it has always had. As a result linemap_lookup as been extended to return a macro map when given a virtual location resulting from a macro expansion. The layout of structs line_map has changed to support this new type of map. So did the layout of struct line_maps. Accessor macros have been introduced to avoid messing with the implementation details of these datastructures directly. This helped already as we have been testing different ways of arranging these datastructure. Having to constantly adjust client code that is too tied with the internals of line_map and line_maps would have been even more painful. Of course, many new public functions have been added to the linemap module to handle the resolution of virtual locations. This patch introduces the infrastructure but no part of the compiler uses virtual locations yet. However the client code of the linemap data structures has been adjusted as per the changes. E.g, it's not anymore reliable for a client code to manipulate struct line_map directly if it just wants to deal with spelling locations, because struct line_map can now represent a macro map as well. In that case, it's better to use the convenient API to resolve the initial (possibly virtual) location to a spelling location (or to an ordinary map) and use that. This is the reason why the patch adjusts the Java, Ada and Fortran front ends. Also, note that virtual locations are not supposed to be ordered for relations '<' and '>' anymore. To test if a virtual location appears "before" another one, one has to use a new operator exposed by the line map interface. The patch updates the only spot (in the diagnostics module) I have found that was making the assumption that locations were ordered for these relations. This is the only change that introduces a use of the new line map API in this patch, so I am adding a regression test for it only. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@180081 138bc75d-0d04-0410-961f-82ee72b054a4
* 2011-05-29 John Tytgat <John.Tytgat@aaug.net>tromey2011-06-021-2/+2
| | | | | | * files.c (read_file_guts): Add test on non-zero value of S_ISREG. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@174571 138bc75d-0d04-0410-961f-82ee72b054a4
* remove useless if-before-free testsmeyering2011-04-201-2/+1
| | | | | | | | | | | Change "if (E) free (E);" to "free (E);" everywhere except in the libgo/, intl/, zlib/ and classpath/ directories. Also transform equivalent variants like "if (E != NULL) free (E);" and allow an extra cast on the argument to free. Otherwise, the tested and freed "E" expressions must be identical, modulo white space. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@172785 138bc75d-0d04-0410-961f-82ee72b054a4
* 2011-03-25 Kai Tietz <ktietz@redhat.com>ktietz2011-03-251-6/+14
| | | | | | | | | | | | | | | | | | | | | | | | * files.c (file_hash_eq): Use filename_cmp instead of strcmp. (nonexistent_file_hash_eq): Likewise. (remap_filename): Likewise. Handle absolute DOS-path, (append_file_to_dir): Check for IS_DIR_SEPARATOR instead of slash. (read_name_map): Likewise. * linemap.c (linemap_add): Use filename_cmp instead of strcmp. * mkdeps.c (apply_vpath): Use filename_ncmp instead of strncmp. (deps_restore): Use filename_cmp instead of strcmp. * init.c (read_original_directory): Use IS_DIR_SEPARATOR instead of checking for slash. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@171521 138bc75d-0d04-0410-961f-82ee72b054a4
* Update Copyright years for files modified in 2010.jakub2011-01-031-1/+1
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@168438 138bc75d-0d04-0410-961f-82ee72b054a4
* 2010-04-09 Manuel López-Ibáñez <manu@gcc.gnu.org>manu2010-04-091-1/+2
| | | | | | | | | | | | | PR cpp/43195 libcpp/ * files.c (report_missing_guard): Test for #pragma once. testsuite/ * gcc.dg/cpp/pr43195.c: New. * gcc.dg/cpp/pr43195.h: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158169 138bc75d-0d04-0410-961f-82ee72b054a4
* 2009-09-22 Richard Guenther <rguenther@suse.de>rguenth2009-09-221-0/+6
| | | | | | | | PR pch/38987 * files.c (pch_open_file): Disallow non-toplevel PCH inclusion. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151970 138bc75d-0d04-0410-961f-82ee72b054a4
* [libcpp/ChangeLog]cgd2009-09-191-6/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2009-09-18 Chris Demetriou <cgd@google.com> PR preprocessor/28435: * include/cpplib.h (struct cpp_options): Add new member deps.need_preprocessor_output. * files.c (open_file_failed): If preprocessor output is needed always report an error. [gcc/ChangeLog] 2009-09-19 Chris Demetriou <cgd@google.com> PR preprocessor/28435: * c-opts.c (c_common_handle_option): For -MD and -MMD, indicate to cpplib that the preprocessor output is needed. [gcc/testsuite/ChangeLog] 2009-09-19 Chris Demetriou <cgd@google.com> PR preprocessor/28435: * gcc.dg/cpp/missing-header-MD.c: New test. * gcc.dg/cpp/missing-header-MMD.c: New test. * gcc.dg/cpp/missing-sysheader-MD.c: New test. * gcc.dg/cpp/missing-sysheader-MMD.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151879 138bc75d-0d04-0410-961f-82ee72b054a4
* 2009-07-17 Jerry Quinn <jlquinn@optonline.net>jlquinn2009-07-181-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * directives.c (do_linemarker, do_line): Use CPP_STRING for ignored enum value. * files.c (find_file_in_dir): Add cast from void* to char*. * symtab.c (ht_lookup_with_hash): Add cast from void* to char*. * Makefile.in: (WARN_CFLAGS): Use general and C-specific warnings. (CXX, CXXFLAGS, WARN_CXXFLAGS, ALL_CXXFLAGS, ENABLE_BUILD_WITH_CXX, CCDEPMODE, CXXDEPMODE, COMPILER, COMPILER_FLAGS): New. (DEPMODE): Set from CCDEPMODE or CXXDEPMODE. (COMPILE.base): Use COMPILER instead of CC. Use COMPILER_FLAGS instead of ALL_CFLAGS. * configure.ac: Invoke AC_PROG_CXX. Separate C-specific warnings from other warnings. Add -Wc++-compat to C-specific warnings. Check for --enable-build-with-cxx. Set and substitute ENABLE_BUILD_WITH_CXX. Invoke ZW_PROG_COMPILER_DEPENDENCIES according to ENABLE_BUILD_WITH_CXX. Invoke AC_LANG before AC_CHECK_HEADERS. * configure: Rebuild. * include/cpp-id-data.h: Remove extern "C". * include/line-map.h: Likewise. * include/mkdeps.h: Likewise. * include/symtab.h: Likewise. * internal.h: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149763 138bc75d-0d04-0410-961f-82ee72b054a4
* 2009-05-14 Manuel Lopez-Ibanez <manu@gcc.gnu.org>manu2009-05-131-7/+8
| | | | | | | | | | | | | | PR cpp/36674 libcpp/ * directives (do_linemarker): Compensate for the increment in location that occurs when we reach the end of line. * files (_cpp_stack_include): Mention _cpp_find_file in the comment. testsuite/ * gcc.dg/cpp/pr36674.i: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@147504 138bc75d-0d04-0410-961f-82ee72b054a4
* Licensing changes to GPLv3 resp. GPLv3 with GCC Runtime Exception.jakub2009-04-091-3/+3
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@145841 138bc75d-0d04-0410-961f-82ee72b054a4
* PR preprocessor/15638jsm282009-03-311-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | gcc: * c-common.c (c_cpp_error): Handle CPP_DL_FATAL. gcc/fortran: * cpp.c (cb_cpp_error): Handle CPP_DL_FATAL. gcc/testsuite: * gcc.dg/cpp/missing-header-1.c: New test. * gcc.dg/cpp/include2.c: Only test #include <>. Expect "compilation terminated" message. * gcc.dg/cpp/include2a.c: New test. Copy of include2.c but only test #include "". * gcc.dg/pch/counter-2.c, gcc.dg/pch/valid-1.c, gcc.dg/pch/valid-2.c, gcc.dg/pch/warn-1.c: Expect "compilation terminated" message. libcpp: * files.c (_cpp_find_file): Call open_file_failed after diagnosing invalid PCH. (open_file_failed): Make error for missing file fatal. * include/cpplib.h (CPP_DL_FATAL): Define. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@145341 138bc75d-0d04-0410-961f-82ee72b054a4
* PR preprocessor/36649jakub2008-07-311-11/+44
| | | | | | | | | | | | | | | | | | | | | * files.c (struct report_missing_guard_data): New type. (report_missing_guard): Put paths into an array instead of printing them right away. Return 1 rather than 0. (report_missing_guard_cmp): New function. (_cpp_report_missing_guards): Sort and print paths gathered by report_missing_guard callback. * gcc.dg/pch/cpp-3.hs: Add include guards. * gcc.dg/pch/cpp-3a.h: Likewise. * gcc.dg/pch/cpp-3b.h: Likewise. * gcc.dg/cpp/mi8.c: New test. * gcc.dg/cpp/mi8a.h: New file. * gcc.dg/cpp/mi8b.h: New file. * gcc.dg/cpp/mi8c.h: New file. * gcc.dg/cpp/mi8d.h: New file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@138432 138bc75d-0d04-0410-961f-82ee72b054a4
* libcpptromey2008-04-211-6/+14
| | | | | | | | | | | | | | | | | 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@134507 138bc75d-0d04-0410-961f-82ee72b054a4
* PR pch/13675jakub2008-04-011-10/+6
| | | | | | | | | | | | | | * 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). git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@133790 138bc75d-0d04-0410-961f-82ee72b054a4
* gcctromey2007-12-061-6/+62
| | | | | | | | | | | | | | | | | | | | | | | 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130656 138bc75d-0d04-0410-961f-82ee72b054a4
* * files.c (search_path_head): Fix check for absolute paths.matz2007-11-161-1/+2
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130229 138bc75d-0d04-0410-961f-82ee72b054a4
* gcc/cptromey2007-11-121-0/+24
| | | | | | | | | | | | | | | | | | | 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130093 138bc75d-0d04-0410-961f-82ee72b054a4
* libcpp/aaw2007-07-301-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@127066 138bc75d-0d04-0410-961f-82ee72b054a4
* * cppfiles.c (open_file): Correct typo.dannysmith2007-06-171-2/+2
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@125778 138bc75d-0d04-0410-961f-82ee72b054a4
* * cppfiles.c (open_file): Prevent the callvprus2007-06-161-0/+3
| | | | | | | for stat from overwriting errno. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@125757 138bc75d-0d04-0410-961f-82ee72b054a4
* * cppfiles.c (open_file): Account for thevprus2007-06-091-0/+13
| | | | | | | | fact that on windows, opening a directory gives EACCES. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@125590 138bc75d-0d04-0410-961f-82ee72b054a4
* * internal.h (struct cpp_reader): Add new fields:ian2007-05-211-4/+73
| | | | | | | | | | | | | | | | | | 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@124929 138bc75d-0d04-0410-961f-82ee72b054a4
* 2006-02-17 Grigory Zagorodnev <grigory_zagorodnev@linux.intel.com>dalecki2006-02-181-0/+7
| | | | | | | | | | | | | | | | | | | | | gcc/ChangeLog: * doc/cpp.texi (__TIMESTAMP__): Document. libcpp/ChangeLog: * macro.c (_cpp_builtin_macro_text): Handle BT_TIMESTAMP. * files.c (_cpp_get_file_stat): New function. * include/cpplib.h (builtin_type): Add BT_TIMESTAMP. * init.c (builtin_array): Add support for __TIMESTAMP__/BT_TIMESTAMP. * internal.h (_cpp_get_file_stat): Prototype. (struct cpp_buffer): Add timestamp. gcc/testsuite/ChangeLog: * gcc.dg/cpp/undef3.c: New test. * gcc.dg/cpp/trad/builtins2.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@111232 138bc75d-0d04-0410-961f-82ee72b054a4
* Fix failure with pragma once where buffer is NULL and buffer_valid is true.wilson2005-11-041-0/+1
| | | | | | | | PR preprocessor/24202 * files.c (_cpp_pop_file_buffer): Set buffer_valid to false. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@106472 138bc75d-0d04-0410-961f-82ee72b054a4
* Fix bug with -MM -MG.wilson2005-10-211-11/+11
| | | | | | | | | | | | | PR preprocessor/15220 * files.c (_cpp_find_file): New parameter angle_brackets. Fix all callers. Pass to open_file_failed. (open_file_failed): New parameter angle_brackets. Fix all callers. Use in print_dep assignment. * init.c (cpp_read_main_file): Pass additional arg to _cpp_find_file. * internal.h (_cpp_find_file): Add new parm to declaration. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@105757 138bc75d-0d04-0410-961f-82ee72b054a4
* PR preprocessor/20348jakub2005-08-301-51/+25
| | | | | | | | | | | | | | | | | | PR preprocessor/20356 * files.c (_cpp_find_file, search_cache): Revert 2004-06-26 and 2004-06-05 changes. * gcc.dg/cpp/pr20348.c: New test. * gcc.dg/cpp/pr20348.h: New file. * gcc.dg/cpp/inc/pr20348.h: New file. * gcc.dg/cpp/inc/pr20348-aux.h: New file. * gcc.dg/cpp/pr20356.c: New test. * gcc.dg/cpp/pr20356.h: New file. * gcc.dg/cpp/inc/pr20356.h: New file. * gcc.dg/cpp/inc/pr20356-aux.h: New file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@103629 138bc75d-0d04-0410-961f-82ee72b054a4
* 2005-06-29 Kelley Cook <kcook@gcc.gnu.org>kcook2005-06-291-1/+1
| | | | | | | | * all files: Update FSF address in copyright headers. * makeucnid.c (write_copyright): Update outputted FSF address. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@101413 138bc75d-0d04-0410-961f-82ee72b054a4
* * configure.ac: Check declarations for asprintf and vasprintf.gdr2005-05-281-29/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@100295 138bc75d-0d04-0410-961f-82ee72b054a4
* From Andris Pavenis, approved by Zack Weinberg, for DJGPP build problem.wilson2005-04-281-0/+1
| | | | | | | * files.c: Include io.h for DJGPP to get prototype of setmode. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@98910 138bc75d-0d04-0410-961f-82ee72b054a4
* * directives.c, files.c, init.c, internal.h, macro.c, pch.c,kazu2005-02-141-1/+1
| | | | | | | traditional.c: Update copyright. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@95012 138bc75d-0d04-0410-961f-82ee72b054a4
* * files.c (pchf_adder): Remove.mrs2005-02-091-57/+40
| | | | | | | | (struct pchf_adder_info): Likewise. (_cpp_save_file_entries): Write out all files so that #import works. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@94755 138bc75d-0d04-0410-961f-82ee72b054a4
* Index: libcpp/ChangeLoggeoffk2005-01-041-1/+9
| | | | | | | | | | | | | | | | | | | | 2005-01-03 Geoffrey Keating <geoffk@apple.com> * files.c (_cpp_find_file): Add files found by search_path_exhausted to the list of all files. Index: gcc/testsuite/ChangeLog 2005-01-03 Geoffrey Keating <geoffk@apple.com> Robert Bowdidge <bowdidge@apple.com> * gcc.dg/cpp/subframework1.c: New. * gcc.dg/cpp/frame/one.framework/Frameworks/OneSub.framework/Headers/A.h: New. * gcc.dg/cpp/frame/one.framework/Frameworks/OneSub.framework/Headers/B.h: New. * gcc.dg/cpp/frame/one.framework/Frameworks/OneSub.framework/Headers/C.h: New. * gcc.dg/cpp/frame/one.framework/Headers/one-includeSubs.h: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@92883 138bc75d-0d04-0410-961f-82ee72b054a4
* PR preprocessor/15167ebotcazou2004-12-151-6/+43
| | | | | | | | | * files.c (destroy_cpp_file): New function. (should_stack_file): Make a new file if the compared file is still stacked. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@92194 138bc75d-0d04-0410-961f-82ee72b054a4
* 2004-07-16 Andris Pavenis <pavenis@latnet.lv>zack2004-07-161-1/+4
| | | | | | | | | | PR preprocessor/16366 * internal.h (struct cpp_reader): New field dir_hash. * files.c (make_cpp_dir): Use dir_hash, not file_hash. (_cpp_init_files, _cpp_cleanup_files): Update for new field. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@84821 138bc75d-0d04-0410-961f-82ee72b054a4
* PR 15933zack2004-06-261-41/+22
| | | | | | | | | | | | Partially revert patch of 2004-06-05. * files.c (search_cache): Remove pfile argument. Don't check for file that would be found by "" or <> search here... (_cpp_find_file): ...do it here, before calling find_file_in_dir. Do not apply directory-of-current-file correction to files found by this check. Rearrange code slightly. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@83714 138bc75d-0d04-0410-961f-82ee72b054a4
* 2004-06-21 Geoffrey Keating <geoffk@apple.com>geoffk2004-06-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * c-opts.c (c_common_handle_option): Handle -fpch-preprocess. * c-common.h (flag_pch_preprocess): Declare. (c_common_pch_pragma): Likewise. * c-common.c (flag_pch_preprocess): New. * c-pch.c (c_common_read_pch): Support -fpreprocess-only. (c_common_pch_pragma): New. * c-ppoutput.c (cb_read_pch): New. (init_pp_output): Support -fpch-preprocess. * c-pragma.c (init_pragma): Support #pragma GNUC pch_preprocess. * c.opt (fpch-preprocess): New. * gcc.c (cpp_options): When save-temps, pass -fpch-preprocess. * doc/cppopts.texi: Document -fpch-preprocess. * doc/invoke.texi (Precompiled Headers): Mention that -fpreprocessed is safe for PCH. Mention that if an option is listed as safe that doesn't mean it does what you expect. Index: gcc/testsuite/ChangeLog 2004-06-21 Geoffrey Keating <geoffk@apple.com> * gcc.dg/pch/save-temps-1.c: New file. * gcc.dg/pch/save-temps-1.hs: New file. Index: libcpp/ChangeLog 2004-06-21 Geoffrey Keating <geoffk@apple.com> * files.c (should_stack_file): Correct swapped parameters to call to cb.read_pch. * pch.c (cpp_valid_state): Handle -fpreprocessed. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@83478 138bc75d-0d04-0410-961f-82ee72b054a4
OpenPOWER on IntegriCloud