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
This commit is contained in:
Zack Weinberg 2003-07-22 16:24:53 +00:00
parent bef89e9e09
commit a2f7be91fc
9 changed files with 40 additions and 27 deletions

View File

@ -1,3 +1,17 @@
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>
* 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>
2003-07-17 Eric Botcazou <ebotcazou@libertysurf.fr>
PR optimization/11536
PR optimization/11536
* unroll.c (loop_iterations): Do not replace a register holding
the final value by its equivalent before the loop if it is not
invariant.
@ -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>
* 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>

View File

@ -44,8 +44,8 @@ print_location (cpp_reader *pfile, unsigned int line, unsigned int col)
{
const struct line_map *map;
map = lookup_line (&pfile->line_maps, line);
print_containing_files (&pfile->line_maps, map);
map = linemap_lookup (&pfile->line_maps, line);
linemap_print_containing_files (&pfile->line_maps, map);
line = SOURCE_LINE (map, line);
if (col == 0)

View File

@ -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
a line number of zero for special states. */
init_line_maps (&pfile->line_maps);
linemap_init (&pfile->line_maps);
/* Initialize lexer state. */
pfile->state.save_comments = ! CPP_OPTION (pfile, discard_comments);
@ -252,7 +252,7 @@ cpp_destroy (cpp_reader *pfile)
free (context);
}
free_line_maps (&pfile->line_maps);
linemap_free (&pfile->line_maps);
free (pfile);
}

View File

@ -898,8 +898,8 @@ _cpp_do_file_change (cpp_reader *pfile, enum lc_reason reason,
const char *to_file, unsigned int file_line,
unsigned int sysp)
{
pfile->map = add_line_map (&pfile->line_maps, reason, sysp,
pfile->line, to_file, file_line);
pfile->map = linemap_add (&pfile->line_maps, reason, sysp,
pfile->line, to_file, file_line);
if (pfile->cb.file_change)
pfile->cb.file_change (pfile, pfile->map);

View File

@ -80,7 +80,7 @@ _cpp_warn_if_unused_macro (cpp_reader *pfile, cpp_hashnode *node,
cpp_macro *macro = node->value.macro;
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,
"macro \"%s\" is not used", NODE_NAME (node));
}

View File

@ -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 void ht_expand (hash_table *);
static double approx_sqrt (double);
/* Calculate the hash of the string STR of length LEN. */
@ -275,7 +276,7 @@ ht_dump_statistics (hash_table *table)
/* Return the approximate positive square root of a number N. This is for
statistical reports, not code generation. */
double
static double
approx_sqrt (double x)
{
double s, d;

View File

@ -78,8 +78,4 @@ extern void ht_forall (hash_table *, ht_cb, const void *);
/* Dump allocation statistics to stderr. */
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 */

View File

@ -30,7 +30,7 @@ static void trace_include (const struct line_maps *, const struct line_map *);
/* Initialize a line map set. */
void
init_line_maps (struct line_maps *set)
linemap_init (struct line_maps *set)
{
set->maps = 0;
set->allocated = 0;
@ -43,7 +43,7 @@ init_line_maps (struct line_maps *set)
/* Free a line map set. */
void
free_line_maps (struct line_maps *set)
linemap_free (struct line_maps *set)
{
if (set->maps)
{
@ -68,9 +68,9 @@ free_line_maps (struct line_maps *set)
function. */
const struct line_map *
add_line_map (struct line_maps *set, enum lc_reason reason,
unsigned int sysp, unsigned int from_line,
const char *to_file, unsigned int to_line)
linemap_add (struct line_maps *set, enum lc_reason reason,
unsigned int sysp, unsigned int from_line,
const char *to_file, unsigned int to_line)
{
struct line_map *map;
@ -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. */
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;
@ -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. */
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)
return;

View File

@ -68,10 +68,10 @@ struct line_maps
};
/* 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. */
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
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 *);
FROM_LINE should be monotonic increasing across calls to this
function. A call to this function can relocate the previous set of
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,
unsigned int from_line, const char *to_file, unsigned int to_line);
/* Given a logical line, returns the map from which the corresponding
(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
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. */
extern void print_containing_files (struct line_maps *,
const struct line_map *);
extern void linemap_print_containing_files (struct line_maps *,
const struct line_map *);
/* Converts a map and logical line to source line. */
#define SOURCE_LINE(MAP, LINE) ((LINE) + (MAP)->to_line - (MAP)->from_line)