Rename struct floc to typedef gmk_floc as an externally scoped symbol.

This commit is contained in:
Paul Smith 2013-01-20 13:16:46 -05:00
parent a45f25ece3
commit 51fb930ef2
12 changed files with 81 additions and 78 deletions

View File

@ -1,5 +1,8 @@
2013-01-20 Paul Smith <psmith@gnu.org> 2013-01-20 Paul Smith <psmith@gnu.org>
* makeint.h: Change struct floc to gmk_floc typedef.
* Many: Use the new typedef.
* make.h: Rename to makeint.h. * make.h: Rename to makeint.h.
* Many: Use the new name makeint.h. * Many: Use the new name makeint.h.

View File

@ -19,20 +19,20 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
struct commands struct commands
{ {
struct floc fileinfo; /* Where commands were defined. */ gmk_floc fileinfo; /* Where commands were defined. */
char *commands; /* Commands text. */ char *commands; /* Commands text. */
char **command_lines; /* Commands chopped up into lines. */ char **command_lines; /* Commands chopped up into lines. */
char *lines_flags; /* One set of flag bits for each line. */ char *lines_flags; /* One set of flag bits for each line. */
unsigned short ncommand_lines;/* Number of command lines. */ unsigned short ncommand_lines;/* Number of command lines. */
char recipe_prefix; /* Recipe prefix for this command set. */ char recipe_prefix; /* Recipe prefix for this command set. */
unsigned int any_recurse:1; /* Nonzero if any 'lines_flags' elt has */ unsigned int any_recurse:1; /* Nonzero if any 'lines_flags' elt has */
/* the COMMANDS_RECURSE bit set. */ /* the COMMANDS_RECURSE bit set. */
}; };
/* Bits in 'lines_flags'. */ /* Bits in 'lines_flags'. */
#define COMMANDS_RECURSE 1 /* Recurses: + or $(MAKE). */ #define COMMANDS_RECURSE 1 /* Recurses: + or $(MAKE). */
#define COMMANDS_SILENT 2 /* Silent: @. */ #define COMMANDS_SILENT 2 /* Silent: @. */
#define COMMANDS_NOERROR 4 /* No errors: -. */ #define COMMANDS_NOERROR 4 /* No errors: -. */
void execute_file_commands (struct file *file); void execute_file_commands (struct file *file);
void print_commands (const struct commands *cmds); void print_commands (const struct commands *cmds);

View File

@ -26,7 +26,7 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
/* Initially, any errors reported when expanding strings will be reported /* Initially, any errors reported when expanding strings will be reported
against the file where the error appears. */ against the file where the error appears. */
const struct floc **expanding_var = &reading_file; const gmk_floc **expanding_var = &reading_file;
/* The next two describe the variable output buffer. /* The next two describe the variable output buffer.
This buffer is used to hold the variable-expansion of a line of the This buffer is used to hold the variable-expansion of a line of the
@ -96,8 +96,8 @@ char *
recursively_expand_for_file (struct variable *v, struct file *file) recursively_expand_for_file (struct variable *v, struct file *file)
{ {
char *value; char *value;
const struct floc *this_var; const gmk_floc *this_var;
const struct floc **saved_varp; const gmk_floc **saved_varp;
struct variable_set_list *save = 0; struct variable_set_list *save = 0;
int set_reading = 0; int set_reading = 0;
@ -463,7 +463,7 @@ variable_expand_for_file (const char *line, struct file *file)
{ {
char *result; char *result;
struct variable_set_list *savev; struct variable_set_list *savev;
const struct floc *savef; const gmk_floc *savef;
if (file == 0) if (file == 0)
return variable_expand (line); return variable_expand (line);

View File

@ -2484,7 +2484,7 @@ func_call (char *o, char **argv, const char *funcname UNUSED)
} }
void void
define_new_function(const struct floc *flocp, define_new_function(const gmk_floc *flocp,
const char *name, int min, int max, int expand, const char *name, int min, int max, int expand,
char *(*func)(char *, char **, const char *)) char *(*func)(char *, char **, const char *))
{ {

View File

@ -107,7 +107,7 @@ func_guile (char *o, char **argv, const char *funcname UNUSED)
/* We could send the flocp to define_new_function(), but since guile is /* We could send the flocp to define_new_function(), but since guile is
"kind of" built-in, that didn't seem so useful. */ "kind of" built-in, that didn't seem so useful. */
int int
guile_gmake_setup (const struct floc *flocp UNUSED) guile_gmake_setup (const gmk_floc *flocp UNUSED)
{ {
/* Initialize the Guile interpreter. */ /* Initialize the Guile interpreter. */
scm_with_guile (guile_init, NULL); scm_with_guile (guile_init, NULL);

2
job.c
View File

@ -469,7 +469,7 @@ child_error (const struct file *file,
const char *pre = "*** "; const char *pre = "*** ";
const char *post = ""; const char *post = "";
const char *dump = ""; const char *dump = "";
struct floc *flocp = &file->cmds->fileinfo; gmk_floc *flocp = &file->cmds->fileinfo;
if (ignored && silent_flag) if (ignored && silent_flag)
return; return;

6
load.c
View File

@ -33,7 +33,7 @@ static void *global_dl = NULL;
#include "variable.h" #include "variable.h"
static int static int
init_symbol (const struct floc *flocp, const char *ldname, load_func_t symp) init_symbol (const gmk_floc *flocp, const char *ldname, load_func_t symp)
{ {
int r; int r;
const char *p; const char *p;
@ -58,7 +58,7 @@ init_symbol (const struct floc *flocp, const char *ldname, load_func_t symp)
} }
int int
load_file (const struct floc *flocp, const char **ldname, int noerror) load_file (const gmk_floc *flocp, const char **ldname, int noerror)
{ {
load_func_t symp; load_func_t symp;
const char *fp; const char *fp;
@ -159,7 +159,7 @@ load_file (const struct floc *flocp, const char **ldname, int noerror)
#else #else
int int
load_file (const struct floc *flocp, const char **ldname, int noerror) load_file (const gmk_floc *flocp, const char **ldname, int noerror)
{ {
if (! noerror) if (! noerror)
fatal (flocp, _("The 'load' operation is not supported on this platform.")); fatal (flocp, _("The 'load' operation is not supported on this platform."));

View File

@ -362,12 +362,12 @@ extern int unixy_shell;
extern struct rlimit stack_limit; extern struct rlimit stack_limit;
#endif #endif
struct floc typedef struct
{ {
const char *filenm; const char *filenm;
unsigned long lineno; unsigned long lineno;
}; } gmk_floc;
#define NILF ((struct floc *)0) #define NILF ((gmk_floc *)0)
#define CSTRLEN(_s) (sizeof (_s)-1) #define CSTRLEN(_s) (sizeof (_s)-1)
#define STRING_SIZE_TUPLE(_s) (_s), CSTRLEN(_s) #define STRING_SIZE_TUPLE(_s) (_s), CSTRLEN(_s)
@ -386,9 +386,9 @@ struct floc
const char *concat (unsigned int, ...); const char *concat (unsigned int, ...);
void message (int prefix, const char *fmt, ...) void message (int prefix, const char *fmt, ...)
__attribute__ ((__format__ (__printf__, 2, 3))); __attribute__ ((__format__ (__printf__, 2, 3)));
void error (const struct floc *flocp, const char *fmt, ...) void error (const gmk_floc *flocp, const char *fmt, ...)
__attribute__ ((__format__ (__printf__, 2, 3))); __attribute__ ((__format__ (__printf__, 2, 3)));
void fatal (const struct floc *flocp, const char *fmt, ...) void fatal (const gmk_floc *flocp, const char *fmt, ...)
__attribute__ ((noreturn, __format__ (__printf__, 2, 3))); __attribute__ ((noreturn, __format__ (__printf__, 2, 3)));
#else #else
const char *concat (); const char *concat ();
@ -473,12 +473,12 @@ int strcache_setbufsize (unsigned int size);
/* Guile support */ /* Guile support */
#ifdef HAVE_GUILE #ifdef HAVE_GUILE
int guile_gmake_setup (const struct floc *flocp); int guile_gmake_setup (const gmk_floc *flocp);
#endif #endif
/* Loadable object support. Sets to the strcached name of the loaded file. */ /* Loadable object support. Sets to the strcached name of the loaded file. */
typedef int (*load_func_t)(const struct floc *flocp); typedef int (*load_func_t)(const gmk_floc *flocp);
int load_file (const struct floc *flocp, const char **filename, int noerror); int load_file (const gmk_floc *flocp, const char **filename, int noerror);
#ifdef HAVE_VFORK_H #ifdef HAVE_VFORK_H
# include <vfork.h> # include <vfork.h>
@ -527,8 +527,8 @@ int strncasecmp (const char *s1, const char *s2, int n);
# endif # endif
#endif #endif
extern const struct floc *reading_file; extern const gmk_floc *reading_file;
extern const struct floc **expanding_var; extern const gmk_floc **expanding_var;
extern char **environ; extern char **environ;

8
misc.c
View File

@ -255,10 +255,10 @@ message (prefix, fmt, va_alist)
void void
#if HAVE_ANSI_COMPILER && USE_VARIADIC && HAVE_STDARG_H #if HAVE_ANSI_COMPILER && USE_VARIADIC && HAVE_STDARG_H
error (const struct floc *flocp, const char *fmt, ...) error (const gmk_floc *flocp, const char *fmt, ...)
#else #else
error (flocp, fmt, va_alist) error (flocp, fmt, va_alist)
const struct floc *flocp; const gmk_floc *flocp;
const char *fmt; const char *fmt;
va_dcl va_dcl
#endif #endif
@ -288,10 +288,10 @@ error (flocp, fmt, va_alist)
void void
#if HAVE_ANSI_COMPILER && USE_VARIADIC && HAVE_STDARG_H #if HAVE_ANSI_COMPILER && USE_VARIADIC && HAVE_STDARG_H
fatal (const struct floc *flocp, const char *fmt, ...) fatal (const gmk_floc *flocp, const char *fmt, ...)
#else #else
fatal (flocp, fmt, va_alist) fatal (flocp, fmt, va_alist)
const struct floc *flocp; const gmk_floc *flocp;
const char *fmt; const char *fmt;
va_dcl va_dcl
#endif #endif

26
read.c
View File

@ -51,7 +51,7 @@ struct ebuffer
char *bufstart; /* Start of the entire buffer. */ char *bufstart; /* Start of the entire buffer. */
unsigned int size; /* Malloc'd size of buffer. */ unsigned int size; /* Malloc'd size of buffer. */
FILE *fp; /* File, or NULL if this is an internal buffer. */ FILE *fp; /* File, or NULL if this is an internal buffer. */
struct floc floc; /* Info on the file in fp (if any). */ gmk_floc floc; /* Info on the file in fp (if any). */
}; };
/* Track the modifiers we can have on variable assignments */ /* Track the modifiers we can have on variable assignments */
@ -125,7 +125,7 @@ static unsigned int max_incl_len;
/* The filename and pointer to line number of the /* The filename and pointer to line number of the
makefile currently being read in. */ makefile currently being read in. */
const struct floc *reading_file = 0; const gmk_floc *reading_file = 0;
/* The chain of files read by read_all_makefiles. */ /* The chain of files read by read_all_makefiles. */
@ -139,16 +139,16 @@ static void do_undefine (char *name, enum variable_origin origin,
struct ebuffer *ebuf); struct ebuffer *ebuf);
static struct variable *do_define (char *name, enum variable_origin origin, static struct variable *do_define (char *name, enum variable_origin origin,
struct ebuffer *ebuf); struct ebuffer *ebuf);
static int conditional_line (char *line, int len, const struct floc *flocp); static int conditional_line (char *line, int len, const gmk_floc *flocp);
static void record_files (struct nameseq *filenames, const char *pattern, static void record_files (struct nameseq *filenames, const char *pattern,
const char *pattern_percent, char *depstr, const char *pattern_percent, char *depstr,
unsigned int cmds_started, char *commands, unsigned int cmds_started, char *commands,
unsigned int commands_idx, int two_colon, unsigned int commands_idx, int two_colon,
char prefix, const struct floc *flocp); char prefix, const gmk_floc *flocp);
static void record_target_var (struct nameseq *filenames, char *defn, static void record_target_var (struct nameseq *filenames, char *defn,
enum variable_origin origin, enum variable_origin origin,
struct vmodifiers *vmod, struct vmodifiers *vmod,
const struct floc *flocp); const gmk_floc *flocp);
static enum make_word_type get_next_mword (char *buffer, char *delim, static enum make_word_type get_next_mword (char *buffer, char *delim,
char **startp, unsigned int *length); char **startp, unsigned int *length);
static void remove_comments (char *line); static void remove_comments (char *line);
@ -319,7 +319,7 @@ eval_makefile (const char *filename, int flags)
{ {
struct dep *deps; struct dep *deps;
struct ebuffer ebuf; struct ebuffer ebuf;
const struct floc *curfile; const gmk_floc *curfile;
char *expanded = 0; char *expanded = 0;
int makefile_errno; int makefile_errno;
@ -440,7 +440,7 @@ eval_buffer (char *buffer)
struct ebuffer ebuf; struct ebuffer ebuf;
struct conditionals *saved; struct conditionals *saved;
struct conditionals new; struct conditionals new;
const struct floc *curfile; const gmk_floc *curfile;
/* Evaluate the buffer */ /* Evaluate the buffer */
@ -564,8 +564,8 @@ eval (struct ebuffer *ebuf, int set_default)
char prefix = cmd_prefix; char prefix = cmd_prefix;
const char *pattern = 0; const char *pattern = 0;
const char *pattern_percent; const char *pattern_percent;
struct floc *fstart; gmk_floc *fstart;
struct floc fi; gmk_floc fi;
#define record_waiting_files() \ #define record_waiting_files() \
do \ do \
@ -1417,7 +1417,7 @@ do_define (char *name, enum variable_origin origin, struct ebuffer *ebuf)
{ {
struct variable *v; struct variable *v;
struct variable var; struct variable var;
struct floc defstart; gmk_floc defstart;
int nlevels = 1; int nlevels = 1;
unsigned int length = 100; unsigned int length = 100;
char *definition = xmalloc (length); char *definition = xmalloc (length);
@ -1533,7 +1533,7 @@ do_define (char *name, enum variable_origin origin, struct ebuffer *ebuf)
1 if following text should be ignored. */ 1 if following text should be ignored. */
static int static int
conditional_line (char *line, int len, const struct floc *flocp) conditional_line (char *line, int len, const gmk_floc *flocp)
{ {
char *cmdname; char *cmdname;
enum { c_ifdef, c_ifndef, c_ifeq, c_ifneq, c_else, c_endif } cmdtype; enum { c_ifdef, c_ifndef, c_ifeq, c_ifneq, c_else, c_endif } cmdtype;
@ -1802,7 +1802,7 @@ conditional_line (char *line, int len, const struct floc *flocp)
static void static void
record_target_var (struct nameseq *filenames, char *defn, record_target_var (struct nameseq *filenames, char *defn,
enum variable_origin origin, struct vmodifiers *vmod, enum variable_origin origin, struct vmodifiers *vmod,
const struct floc *flocp) const gmk_floc *flocp)
{ {
struct nameseq *nextf; struct nameseq *nextf;
struct variable_set_list *global; struct variable_set_list *global;
@ -1907,7 +1907,7 @@ record_files (struct nameseq *filenames, const char *pattern,
const char *pattern_percent, char *depstr, const char *pattern_percent, char *depstr,
unsigned int cmds_started, char *commands, unsigned int cmds_started, char *commands,
unsigned int commands_idx, int two_colon, unsigned int commands_idx, int two_colon,
char prefix, const struct floc *flocp) char prefix, const gmk_floc *flocp)
{ {
struct commands *cmds; struct commands *cmds;
struct dep *deps; struct dep *deps;

View File

@ -193,7 +193,7 @@ struct variable *
define_variable_in_set (const char *name, unsigned int length, define_variable_in_set (const char *name, unsigned int length,
const char *value, enum variable_origin origin, const char *value, enum variable_origin origin,
int recursive, struct variable_set *set, int recursive, struct variable_set *set,
const struct floc *flocp) const gmk_floc *flocp)
{ {
struct variable *v; struct variable *v;
struct variable **var_slot; struct variable **var_slot;
@ -1136,7 +1136,7 @@ shell_result (const char *p)
See the try_variable_definition() function for details on the parameters. */ See the try_variable_definition() function for details on the parameters. */
struct variable * struct variable *
do_variable_definition (const struct floc *flocp, const char *varname, do_variable_definition (const gmk_floc *flocp, const char *varname,
const char *value, enum variable_origin origin, const char *value, enum variable_origin origin,
enum variable_flavor flavor, int target_var) enum variable_flavor flavor, int target_var)
{ {
@ -1572,7 +1572,7 @@ assign_variable_definition (struct variable *v, char *line)
returned. */ returned. */
struct variable * struct variable *
try_variable_definition (const struct floc *flocp, char *line, try_variable_definition (const gmk_floc *flocp, char *line,
enum variable_origin origin, int target_var) enum variable_origin origin, int target_var)
{ {
struct variable v; struct variable v;

View File

@ -20,14 +20,14 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
Increasing numeric values signify less-overridable definitions. */ Increasing numeric values signify less-overridable definitions. */
enum variable_origin enum variable_origin
{ {
o_default, /* Variable from the default set. */ o_default, /* Variable from the default set. */
o_env, /* Variable from environment. */ o_env, /* Variable from environment. */
o_file, /* Variable given in a makefile. */ o_file, /* Variable given in a makefile. */
o_env_override, /* Variable from environment, if -e. */ o_env_override, /* Variable from environment, if -e. */
o_command, /* Variable given by user. */ o_command, /* Variable given by user. */
o_override, /* Variable from an 'override' directive. */ o_override, /* Variable from an 'override' directive. */
o_automatic, /* Automatic variable -- cannot be set. */ o_automatic, /* Automatic variable -- cannot be set. */
o_invalid /* Core dump time. */ o_invalid /* Core dump time. */
}; };
enum variable_flavor enum variable_flavor
@ -49,34 +49,34 @@ enum variable_flavor
struct variable struct variable
{ {
char *name; /* Variable name. */ char *name; /* Variable name. */
char *value; /* Variable value. */ char *value; /* Variable value. */
struct floc fileinfo; /* Where the variable was defined. */ gmk_floc fileinfo; /* Where the variable was defined. */
int length; /* strlen (name) */ int length; /* strlen (name) */
unsigned int recursive:1; /* Gets recursively re-evaluated. */ unsigned int recursive:1; /* Gets recursively re-evaluated. */
unsigned int append:1; /* Nonzero if an appending target-specific unsigned int append:1; /* Nonzero if an appending target-specific
variable. */ variable. */
unsigned int conditional:1; /* Nonzero if set with a ?=. */ unsigned int conditional:1; /* Nonzero if set with a ?=. */
unsigned int per_target:1; /* Nonzero if a target-specific variable. */ unsigned int per_target:1; /* Nonzero if a target-specific variable. */
unsigned int special:1; /* Nonzero if this is a special variable. */ unsigned int special:1; /* Nonzero if this is a special variable. */
unsigned int exportable:1; /* Nonzero if the variable _could_ be unsigned int exportable:1; /* Nonzero if the variable _could_ be
exported. */ exported. */
unsigned int expanding:1; /* Nonzero if currently being expanded. */ unsigned int expanding:1; /* Nonzero if currently being expanded. */
unsigned int private_var:1; /* Nonzero avoids inheritance of this unsigned int private_var:1; /* Nonzero avoids inheritance of this
target-specific variable. */ target-specific variable. */
unsigned int exp_count:EXP_COUNT_BITS; unsigned int exp_count:EXP_COUNT_BITS;
/* If >1, allow this many self-referential /* If >1, allow this many self-referential
expansions. */ expansions. */
enum variable_flavor enum variable_flavor
flavor ENUM_BITFIELD (3); /* Variable flavor. */ flavor ENUM_BITFIELD (3); /* Variable flavor. */
enum variable_origin enum variable_origin
origin ENUM_BITFIELD (3); /* Variable origin. */ origin ENUM_BITFIELD (3); /* Variable origin. */
enum variable_export enum variable_export
{ {
v_export, /* Export this variable. */ v_export, /* Export this variable. */
v_noexport, /* Don't export this variable. */ v_noexport, /* Don't export this variable. */
v_ifset, /* Export it if it has a non-default value. */ v_ifset, /* Export it if it has a non-default value. */
v_default /* Decide in target_environment. */ v_default /* Decide in target_environment. */
} export ENUM_BITFIELD (2); } export ENUM_BITFIELD (2);
}; };
@ -84,15 +84,15 @@ struct variable
struct variable_set struct variable_set
{ {
struct hash_table table; /* Hash table of variables. */ struct hash_table table; /* Hash table of variables. */
}; };
/* Structure that represents a list of variable sets. */ /* Structure that represents a list of variable sets. */
struct variable_set_list struct variable_set_list
{ {
struct variable_set_list *next; /* Link in the chain. */ struct variable_set_list *next; /* Link in the chain. */
struct variable_set *set; /* Variable set. */ struct variable_set *set; /* Variable set. */
int next_is_parent; /* True if next is a parent target. */ int next_is_parent; /* True if next is a parent target. */
}; };
@ -116,7 +116,7 @@ char *variable_buffer_output (char *ptr, const char *string, unsigned int length
char *variable_expand (const char *line); char *variable_expand (const char *line);
char *variable_expand_for_file (const char *line, struct file *file); char *variable_expand_for_file (const char *line, struct file *file);
char *allocated_variable_expand_for_file (const char *line, struct file *file); char *allocated_variable_expand_for_file (const char *line, struct file *file);
#define allocated_variable_expand(line) \ #define allocated_variable_expand(line) \
allocated_variable_expand_for_file (line, (struct file *) 0) allocated_variable_expand_for_file (line, (struct file *) 0)
char *expand_argument (const char *str, const char *end); char *expand_argument (const char *str, const char *end);
char *variable_expand_string (char *line, const char *string, long length); char *variable_expand_string (char *line, const char *string, long length);
@ -152,7 +152,7 @@ void print_file_variables (const struct file *file);
void print_target_variables (const struct file *file); void print_target_variables (const struct file *file);
void merge_variable_set_lists (struct variable_set_list **to_list, void merge_variable_set_lists (struct variable_set_list **to_list,
struct variable_set_list *from_list); struct variable_set_list *from_list);
struct variable *do_variable_definition (const struct floc *flocp, struct variable *do_variable_definition (const gmk_floc *flocp,
const char *name, const char *value, const char *name, const char *value,
enum variable_origin origin, enum variable_origin origin,
enum variable_flavor flavor, enum variable_flavor flavor,
@ -160,12 +160,12 @@ struct variable *do_variable_definition (const struct floc *flocp,
char *parse_variable_definition (const char *line, char *parse_variable_definition (const char *line,
struct variable *v); struct variable *v);
struct variable *assign_variable_definition (struct variable *v, char *line); struct variable *assign_variable_definition (struct variable *v, char *line);
struct variable *try_variable_definition (const struct floc *flocp, char *line, struct variable *try_variable_definition (const gmk_floc *flocp, char *line,
enum variable_origin origin, enum variable_origin origin,
int target_var); int target_var);
void init_hash_global_variable_set (void); void init_hash_global_variable_set (void);
void hash_init_function_table (void); void hash_init_function_table (void);
void define_new_function(const struct floc *flocp, void define_new_function(const gmk_floc *flocp,
const char *name, int min, int max, int expand, const char *name, int min, int max, int expand,
char *(*func)(char *, char **, const char *)); char *(*func)(char *, char **, const char *));
struct variable *lookup_variable (const char *name, unsigned int length); struct variable *lookup_variable (const char *name, unsigned int length);
@ -177,7 +177,7 @@ struct variable *define_variable_in_set (const char *name, unsigned int length,
enum variable_origin origin, enum variable_origin origin,
int recursive, int recursive,
struct variable_set *set, struct variable_set *set,
const struct floc *flocp); const gmk_floc *flocp);
/* Define a variable in the current variable set. */ /* Define a variable in the current variable set. */