Commit a2f7be91 by Zack Weinberg

hashtable.c (approx_sqrt): Make static.

	* hashtable.c (approx_sqrt): Make static.
	* hashtable.h: Don't prototype approx_sqrt.
	* line-map.c (init_line_maps): Rename linemap_init.
	(free_line_maps): Rename linemap_free.
	(add_line_map): Rename linemap_add.
	(lookup_line): Rename linemap_lookup.
	(print_containing_files): Rename linemap_print_containing_files.
	* linemap.h: Update to match.

	* cpperror.c, cppinit.c, cpplib.c, cppmacro.c: Update calls to
	linemap routines to use new names.

From-SVN: r69672
parent bef89e9e
2003-07-22 Zack Weinberg <zack@codesourcery.com>
* hashtable.c (approx_sqrt): Make static.
* hashtable.h: Don't prototype approx_sqrt.
* line-map.c (init_line_maps): Rename linemap_init.
(free_line_maps): Rename linemap_free.
(add_line_map): Rename linemap_add.
(lookup_line): Rename linemap_lookup.
(print_containing_files): Rename linemap_print_containing_files.
* linemap.h: Update to match.
* cpperror.c, cppinit.c, cpplib.c, cppmacro.c: Update calls to
linemap routines to use new names.
2003-07-16 Nathan Sidwell <nathan@codesourcery.com> 2003-07-16 Nathan Sidwell <nathan@codesourcery.com>
* c-common.c (handle_packed_attribute): Don't pack a struct via a * c-common.c (handle_packed_attribute): Don't pack a struct via a
...@@ -77,7 +91,7 @@ Tue Jul 22 00:42:12 CEST 2003 Jan Hubicka <jh@suse.cz> ...@@ -77,7 +91,7 @@ Tue Jul 22 00:42:12 CEST 2003 Jan Hubicka <jh@suse.cz>
2003-07-17 Eric Botcazou <ebotcazou@libertysurf.fr> 2003-07-17 Eric Botcazou <ebotcazou@libertysurf.fr>
PR optimization/11536 PR optimization/11536
* unroll.c (loop_iterations): Do not replace a register holding * unroll.c (loop_iterations): Do not replace a register holding
the final value by its equivalent before the loop if it is not the final value by its equivalent before the loop if it is not
invariant. invariant.
...@@ -93,7 +107,7 @@ Tue Jul 22 00:42:12 CEST 2003 Jan Hubicka <jh@suse.cz> ...@@ -93,7 +107,7 @@ Tue Jul 22 00:42:12 CEST 2003 Jan Hubicka <jh@suse.cz>
2003-07-20 Lisa M. Goldstein <opus@gnu.org> 2003-07-20 Lisa M. Goldstein <opus@gnu.org>
* doc/invoke.texi: Fixes to style, grammar and diction. * doc/invoke.texi: Fixes to style, grammar and diction.
2003-07-20 Roger Sayle <roger@eyesopen.com> 2003-07-20 Roger Sayle <roger@eyesopen.com>
......
...@@ -44,8 +44,8 @@ print_location (cpp_reader *pfile, unsigned int line, unsigned int col) ...@@ -44,8 +44,8 @@ print_location (cpp_reader *pfile, unsigned int line, unsigned int col)
{ {
const struct line_map *map; const struct line_map *map;
map = lookup_line (&pfile->line_maps, line); map = linemap_lookup (&pfile->line_maps, line);
print_containing_files (&pfile->line_maps, map); linemap_print_containing_files (&pfile->line_maps, map);
line = SOURCE_LINE (map, line); line = SOURCE_LINE (map, line);
if (col == 0) if (col == 0)
......
...@@ -163,7 +163,7 @@ cpp_create_reader (enum c_lang lang, hash_table *table) ...@@ -163,7 +163,7 @@ cpp_create_reader (enum c_lang lang, hash_table *table)
/* Initialize the line map. Start at logical line 1, so we can use /* Initialize the line map. Start at logical line 1, so we can use
a line number of zero for special states. */ a line number of zero for special states. */
init_line_maps (&pfile->line_maps); linemap_init (&pfile->line_maps);
/* Initialize lexer state. */ /* Initialize lexer state. */
pfile->state.save_comments = ! CPP_OPTION (pfile, discard_comments); pfile->state.save_comments = ! CPP_OPTION (pfile, discard_comments);
...@@ -252,7 +252,7 @@ cpp_destroy (cpp_reader *pfile) ...@@ -252,7 +252,7 @@ cpp_destroy (cpp_reader *pfile)
free (context); free (context);
} }
free_line_maps (&pfile->line_maps); linemap_free (&pfile->line_maps);
free (pfile); free (pfile);
} }
......
...@@ -898,8 +898,8 @@ _cpp_do_file_change (cpp_reader *pfile, enum lc_reason reason, ...@@ -898,8 +898,8 @@ _cpp_do_file_change (cpp_reader *pfile, enum lc_reason reason,
const char *to_file, unsigned int file_line, const char *to_file, unsigned int file_line,
unsigned int sysp) unsigned int sysp)
{ {
pfile->map = add_line_map (&pfile->line_maps, reason, sysp, pfile->map = linemap_add (&pfile->line_maps, reason, sysp,
pfile->line, to_file, file_line); pfile->line, to_file, file_line);
if (pfile->cb.file_change) if (pfile->cb.file_change)
pfile->cb.file_change (pfile, pfile->map); pfile->cb.file_change (pfile, pfile->map);
......
...@@ -80,7 +80,7 @@ _cpp_warn_if_unused_macro (cpp_reader *pfile, cpp_hashnode *node, ...@@ -80,7 +80,7 @@ _cpp_warn_if_unused_macro (cpp_reader *pfile, cpp_hashnode *node,
cpp_macro *macro = node->value.macro; cpp_macro *macro = node->value.macro;
if (!macro->used if (!macro->used
&& MAIN_FILE_P (lookup_line (&pfile->line_maps, macro->line))) && MAIN_FILE_P (linemap_lookup (&pfile->line_maps, macro->line)))
cpp_error_with_line (pfile, DL_WARNING, macro->line, 0, cpp_error_with_line (pfile, DL_WARNING, macro->line, 0,
"macro \"%s\" is not used", NODE_NAME (node)); "macro \"%s\" is not used", NODE_NAME (node));
} }
......
...@@ -32,6 +32,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ...@@ -32,6 +32,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static unsigned int calc_hash (const unsigned char *, unsigned int); static unsigned int calc_hash (const unsigned char *, unsigned int);
static void ht_expand (hash_table *); static void ht_expand (hash_table *);
static double approx_sqrt (double);
/* Calculate the hash of the string STR of length LEN. */ /* Calculate the hash of the string STR of length LEN. */
...@@ -275,7 +276,7 @@ ht_dump_statistics (hash_table *table) ...@@ -275,7 +276,7 @@ ht_dump_statistics (hash_table *table)
/* Return the approximate positive square root of a number N. This is for /* Return the approximate positive square root of a number N. This is for
statistical reports, not code generation. */ statistical reports, not code generation. */
double static double
approx_sqrt (double x) approx_sqrt (double x)
{ {
double s, d; double s, d;
......
...@@ -78,8 +78,4 @@ extern void ht_forall (hash_table *, ht_cb, const void *); ...@@ -78,8 +78,4 @@ extern void ht_forall (hash_table *, ht_cb, const void *);
/* Dump allocation statistics to stderr. */ /* Dump allocation statistics to stderr. */
extern void ht_dump_statistics (hash_table *); extern void ht_dump_statistics (hash_table *);
/* Approximate positive square root of a host double. This is for
statistical reports, not code generation. */
extern double approx_sqrt (double);
#endif /* GCC_HASHTABLE_H */ #endif /* GCC_HASHTABLE_H */
...@@ -30,7 +30,7 @@ static void trace_include (const struct line_maps *, const struct line_map *); ...@@ -30,7 +30,7 @@ static void trace_include (const struct line_maps *, const struct line_map *);
/* Initialize a line map set. */ /* Initialize a line map set. */
void void
init_line_maps (struct line_maps *set) linemap_init (struct line_maps *set)
{ {
set->maps = 0; set->maps = 0;
set->allocated = 0; set->allocated = 0;
...@@ -43,7 +43,7 @@ init_line_maps (struct line_maps *set) ...@@ -43,7 +43,7 @@ init_line_maps (struct line_maps *set)
/* Free a line map set. */ /* Free a line map set. */
void void
free_line_maps (struct line_maps *set) linemap_free (struct line_maps *set)
{ {
if (set->maps) if (set->maps)
{ {
...@@ -68,9 +68,9 @@ free_line_maps (struct line_maps *set) ...@@ -68,9 +68,9 @@ free_line_maps (struct line_maps *set)
function. */ function. */
const struct line_map * const struct line_map *
add_line_map (struct line_maps *set, enum lc_reason reason, linemap_add (struct line_maps *set, enum lc_reason reason,
unsigned int sysp, unsigned int from_line, unsigned int sysp, unsigned int from_line,
const char *to_file, unsigned int to_line) const char *to_file, unsigned int to_line)
{ {
struct line_map *map; struct line_map *map;
...@@ -151,7 +151,7 @@ add_line_map (struct line_maps *set, enum lc_reason reason, ...@@ -151,7 +151,7 @@ add_line_map (struct line_maps *set, enum lc_reason reason,
the list is sorted and we can use a binary search. */ the list is sorted and we can use a binary search. */
const struct line_map * const struct line_map *
lookup_line (struct line_maps *set, unsigned int line) linemap_lookup (struct line_maps *set, unsigned int line)
{ {
unsigned int md, mn = 0, mx = set->used; unsigned int md, mn = 0, mx = set->used;
...@@ -175,7 +175,8 @@ lookup_line (struct line_maps *set, unsigned int line) ...@@ -175,7 +175,8 @@ lookup_line (struct line_maps *set, unsigned int line)
the most recently listed stack is the same as the current one. */ the most recently listed stack is the same as the current one. */
void void
print_containing_files (struct line_maps *set, const struct line_map *map) linemap_print_containing_files (struct line_maps *set,
const struct line_map *map)
{ {
if (MAIN_FILE_P (map) || set->last_listed == map->included_from) if (MAIN_FILE_P (map) || set->last_listed == map->included_from)
return; return;
......
...@@ -68,10 +68,10 @@ struct line_maps ...@@ -68,10 +68,10 @@ struct line_maps
}; };
/* Initialize a line map set. */ /* Initialize a line map set. */
extern void init_line_maps (struct line_maps *); extern void linemap_init (struct line_maps *);
/* Free a line map set. */ /* Free a line map set. */
extern void free_line_maps (struct line_maps *); extern void linemap_free (struct line_maps *);
/* Add a mapping of logical source line to physical source file and /* Add a mapping of logical source line to physical source file and
line number. The text pointed to by TO_FILE must have a lifetime line number. The text pointed to by TO_FILE must have a lifetime
...@@ -82,19 +82,20 @@ extern void free_line_maps (struct line_maps *); ...@@ -82,19 +82,20 @@ extern void free_line_maps (struct line_maps *);
FROM_LINE should be monotonic increasing across calls to this FROM_LINE should be monotonic increasing across calls to this
function. A call to this function can relocate the previous set of function. A call to this function can relocate the previous set of
maps, so any stored line_map pointers should not be used. */ maps, so any stored line_map pointers should not be used. */
extern const struct line_map *add_line_map extern const struct line_map *linemap_add
(struct line_maps *, enum lc_reason, unsigned int sysp, (struct line_maps *, enum lc_reason, unsigned int sysp,
unsigned int from_line, const char *to_file, unsigned int to_line); unsigned int from_line, const char *to_file, unsigned int to_line);
/* Given a logical line, returns the map from which the corresponding /* Given a logical line, returns the map from which the corresponding
(source file, line) pair can be deduced. */ (source file, line) pair can be deduced. */
extern const struct line_map *lookup_line (struct line_maps *, unsigned int); extern const struct line_map *linemap_lookup (struct line_maps *,
unsigned int);
/* Print the file names and line numbers of the #include commands /* Print the file names and line numbers of the #include commands
which led to the map MAP, if any, to stderr. Nothing is output if which led to the map MAP, if any, to stderr. Nothing is output if
the most recently listed stack is the same as the current one. */ the most recently listed stack is the same as the current one. */
extern void print_containing_files (struct line_maps *, extern void linemap_print_containing_files (struct line_maps *,
const struct line_map *); const struct line_map *);
/* Converts a map and logical line to source line. */ /* Converts a map and logical line to source line. */
#define SOURCE_LINE(MAP, LINE) ((LINE) + (MAP)->to_line - (MAP)->from_line) #define SOURCE_LINE(MAP, LINE) ((LINE) + (MAP)->to_line - (MAP)->from_line)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment