2020-05-18 Nathan Sidwell <nathan@acm.org>
+ * include/cpplib.h (cpp_get_otions, cpp_get_callbacks)
+ (cpp_get_deps): Mark as PURE.
+ * include/line-map.h (get_combined_adhoc_loc)
+ (get_location_from_adhoc_loc, get_pure_location): Reformat decls.
+ * internal.h (struct lexer_state): Clarify comment.
+ * system.h: Remove now-unneeded bool hackery.
+ * files.c (_cpp_find_file): Store LOC not highest_location.
+
PR preprocessor/95149
* lex.c (struct lit_accum): New.
(bufring_append): Replace by lit_accum::append.
entry = new_file_hash_entry (pfile);
entry->next = (struct cpp_file_hash_entry *) *hash_slot;
entry->start_dir = start_dir;
- entry->location = pfile->line_table->highest_location;
+ entry->location = loc;
entry->u.file = file;
*hash_slot = (void *) entry;
entry = new_file_hash_entry (pfile);
entry->next = (struct cpp_file_hash_entry *) *hash_slot;
entry->start_dir = pfile->bracket_include;
- entry->location = pfile->line_table->highest_location;
+ entry->location = loc;
entry->u.file = file;
*hash_slot = (void *) entry;
}
entry = new_file_hash_entry (pfile);
entry->next = (struct cpp_file_hash_entry *) *hash_slot;
entry->start_dir = pfile->quote_include;
- entry->location = pfile->line_table->highest_location;
+ entry->location = loc;
entry->u.file = file;
*hash_slot = (void *) entry;
}
call cpp_finish on that reader. You can either edit the callbacks
through the pointer returned from cpp_get_callbacks, or set them
with cpp_set_callbacks. */
-extern cpp_options *cpp_get_options (cpp_reader *);
-extern cpp_callbacks *cpp_get_callbacks (cpp_reader *);
+extern cpp_options *cpp_get_options (cpp_reader *) ATTRIBUTE_PURE;
+extern cpp_callbacks *cpp_get_callbacks (cpp_reader *) ATTRIBUTE_PURE;
extern void cpp_set_callbacks (cpp_reader *, cpp_callbacks *);
-extern class mkdeps *cpp_get_deps (cpp_reader *);
+extern class mkdeps *cpp_get_deps (cpp_reader *) ATTRIBUTE_PURE;
/* This function reads the file, but does not start preprocessing. It
returns the name of the original file; this is the same as the
return (line_map_macro *)LINEMAPS_LAST_ALLOCATED_MAP (set, true);
}
-extern location_t get_combined_adhoc_loc (class line_maps *,
- location_t,
- source_range,
- void *);
+extern location_t get_combined_adhoc_loc (line_maps *, location_t,
+ source_range, void *);
extern void *get_data_from_adhoc_loc (const line_maps *, location_t);
extern location_t get_location_from_adhoc_loc (const line_maps *,
- location_t);
+ location_t);
extern source_range get_range_from_loc (line_maps *set, location_t loc);
/* Given location LOC within SET, strip away any packed range information
or ad-hoc information. */
-extern location_t get_pure_location (line_maps *set,
- location_t loc);
+extern location_t get_pure_location (line_maps *set, location_t loc);
/* Combine LOC and BLOCK, giving a combined adhoc location. */
/* Nonzero to skip evaluating part of an expression. */
unsigned int skip_eval;
- /* Nonzero when handling a deferred pragma. */
+ /* Nonzero when tokenizing a deferred pragma. */
unsigned char in_deferred_pragma;
/* Nonzero if the deferred pragma being handled allows macro expansion. */
#define gcc_checking_assert(EXPR) ((void)(0 && (EXPR)))
#endif
-/* Provide a fake boolean type. We make no attempt to use the
- C99 _Bool, as it may not be available in the bootstrap compiler,
- and even if it is, it is liable to be buggy.
- This must be after all inclusion of system headers, as some of
- them will mess us up. */
-#undef bool
-#undef true
-#undef false
-#undef TRUE
-#undef FALSE
-
-#ifndef __cplusplus
-#define bool unsigned char
-#endif
-#define true 1
-#define false 0
-
-/* Some compilers do not allow the use of unsigned char in bitfields. */
-#define BOOL_BITFIELD unsigned int
-
/* Poison identifiers we do not want to use. */
#if (GCC_VERSION >= 3000)
#undef calloc