Ignore:
Timestamp:
Mar 12, 2018, 8:32:29 PM (7 years ago)
Author:
bird
Message:

Imported make 4.2.1 (2e55f5e4abdc0e38c1d64be703b446695e70b3b6) from https://git.savannah.gnu.org/git/make.git.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/gnumake/current/variable.h

    r2596 r3138  
    11/* Definitions for using variables in GNU Make.
    2 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
    3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
    4 2010 Free Software Foundation, Inc.
     2Copyright (C) 1988-2016 Free Software Foundation, Inc.
    53This file is part of GNU Make.
    64
     
    2321enum variable_origin
    2422  {
    25     o_default,          /* Variable from the default set.  */
    26     o_env,              /* Variable from environment.  */
    27     o_file,             /* Variable given in a makefile.  */
    28     o_env_override,     /* Variable from environment, if -e.  */
    29     o_command,          /* Variable given by user.  */
    30     o_override,         /* Variable from an `override' directive.  */
    31     o_automatic,        /* Automatic variable -- cannot be set.  */
    32     o_invalid           /* Core dump time.  */
     23    o_default,          /* Variable from the default set.  */
     24    o_env,              /* Variable from environment.  */
     25    o_file,             /* Variable given in a makefile.  */
     26    o_env_override,     /* Variable from environment, if -e.  */
     27    o_command,          /* Variable given by user.  */
     28    o_override,         /* Variable from an 'override' directive.  */
     29    o_automatic,        /* Automatic variable -- cannot be set.  */
     30    o_invalid           /* Core dump time.  */
    3331  };
    3432
     
    3634  {
    3735    f_bogus,            /* Bogus (error) */
    38     f_simple,           /* Simple definition (:=) */
     36    f_simple,           /* Simple definition (:= or ::=) */
    3937    f_recursive,        /* Recursive definition (=) */
    4038    f_append,           /* Appending definition (+=) */
    41     f_conditional       /* Conditional definition (?=) */
     39    f_conditional,      /* Conditional definition (?=) */
     40    f_shell             /* Shell assignment (!=) */
    4241  };
    4342
    4443/* Structure that represents one variable definition.
    4544   Each bucket of the hash table is a chain of these,
    46    chained through `next'.  */
     45   chained through 'next'.  */
    4746
    4847#define EXP_COUNT_BITS  15      /* This gets all the bitfields into 32 bits */
     
    5150struct variable
    5251  {
    53     char *name;                 /* Variable name.  */
    54     int length;                 /* strlen (name) */
    55     char *value;                /* Variable value.  */
    56     struct floc fileinfo;       /* Where the variable was defined. */
    57     unsigned int recursive:1;   /* Gets recursively re-evaluated.  */
    58     unsigned int append:1;      /* Nonzero if an appending target-specific
     52    char *name;                 /* Variable name.  */
     53    char *value;                /* Variable value. */
     54    floc fileinfo;              /* Where the variable was defined.  */
     55    int length;                 /* strlen (name) */
     56    unsigned int recursive:1;   /* Gets recursively re-evaluated.  */
     57    unsigned int append:1;      /* Nonzero if an appending target-specific
    5958                                   variable.  */
    6059    unsigned int conditional:1; /* Nonzero if set with a ?=. */
    61     unsigned int per_target:1;  /* Nonzero if a target-specific variable.  */
     60    unsigned int per_target:1;  /* Nonzero if a target-specific variable.  */
    6261    unsigned int special:1;     /* Nonzero if this is a special variable.  */
    6362    unsigned int exportable:1;  /* Nonzero if the variable _could_ be
    6463                                   exported.  */
    65     unsigned int expanding:1;   /* Nonzero if currently being expanded.  */
     64    unsigned int expanding:1;   /* Nonzero if currently being expanded.  */
    6665    unsigned int private_var:1; /* Nonzero avoids inheritance of this
    6766                                   target-specific variable.  */
     
    7069                                   expansions.  */
    7170    enum variable_flavor
    72       flavor ENUM_BITFIELD (3); /* Variable flavor.  */
     71      flavor ENUM_BITFIELD (3); /* Variable flavor.  */
    7372    enum variable_origin
    74       origin ENUM_BITFIELD (3); /* Variable origin.  */
     73      origin ENUM_BITFIELD (3); /* Variable origin.  */
    7574    enum variable_export
    7675      {
    77         v_export,               /* Export this variable.  */
    78         v_noexport,             /* Don't export this variable.  */
    79         v_ifset,                /* Export it if it has a non-default value.  */
    80         v_default               /* Decide in target_environment.  */
     76        v_export,               /* Export this variable.  */
     77        v_noexport,             /* Don't export this variable.  */
     78        v_ifset,                /* Export it if it has a non-default value.  */
     79        v_default               /* Decide in target_environment.  */
    8180      } export ENUM_BITFIELD (2);
    8281  };
     
    8685struct variable_set
    8786  {
    88     struct hash_table table;    /* Hash table of variables.  */
     87    struct hash_table table;    /* Hash table of variables.  */
    8988  };
    9089
     
    9392struct variable_set_list
    9493  {
    95     struct variable_set_list *next;     /* Link in the chain.  */
    96     struct variable_set *set;           /* Variable set.  */
     94    struct variable_set_list *next;     /* Link in the chain.  */
     95    struct variable_set *set;           /* Variable set.  */
    9796    int next_is_parent;                 /* True if next is a parent target.  */
    9897  };
     
    112111extern struct variable_set_list *current_variable_set_list;
    113112extern struct variable *default_goal_var;
     113extern struct variable shell_var;
    114114
    115115/* expand.c */
     
    118118char *variable_expand_for_file (const char *line, struct file *file);
    119119char *allocated_variable_expand_for_file (const char *line, struct file *file);
    120 #define allocated_variable_expand(line) \
     120#define allocated_variable_expand(line) \
    121121  allocated_variable_expand_for_file (line, (struct file *) 0)
    122122char *expand_argument (const char *str, const char *end);
     
    135135                           const char *replace_percent);
    136136char *patsubst_expand (char *o, const char *text, char *pattern, char *replace);
     137char *func_shell_base (char *o, char **argv, int trim_newlines);
     138void shell_completed (int exit_code, int exit_sig);
    137139
    138140/* expand.c */
     
    148150void initialize_file_variables (struct file *file, int reading);
    149151void print_file_variables (const struct file *file);
    150 void print_variable_set (struct variable_set *set, char *prefix);
     152void print_target_variables (const struct file *file);
    151153void merge_variable_set_lists (struct variable_set_list **to_list,
    152154                               struct variable_set_list *from_list);
    153 struct variable *do_variable_definition (const struct floc *flocp,
     155struct variable *do_variable_definition (const floc *flocp,
    154156                                         const char *name, const char *value,
    155157                                         enum variable_origin origin,
     
    157159                                         int target_var);
    158160char *parse_variable_definition (const char *line,
    159                                  enum variable_flavor *flavor);
    160 struct variable *assign_variable_definition (struct variable *v, char *line);
    161 struct variable *try_variable_definition (const struct floc *flocp, char *line,
     161                                 struct variable *v);
     162struct variable *assign_variable_definition (struct variable *v, const char *line);
     163struct variable *try_variable_definition (const floc *flocp, const char *line,
    162164                                          enum variable_origin origin,
    163165                                          int target_var);
    164166void init_hash_global_variable_set (void);
    165167void hash_init_function_table (void);
     168void define_new_function(const floc *flocp, const char *name,
     169                         unsigned int min, unsigned int max, unsigned int flags,
     170                         gmk_func_ptr func);
    166171struct variable *lookup_variable (const char *name, unsigned int length);
    167172struct variable *lookup_variable_in_set (const char *name, unsigned int length,
     
    173178                                         int recursive,
    174179                                         struct variable_set *set,
    175                                          const struct floc *flocp);
     180                                         const floc *flocp);
    176181
    177182/* Define a variable in the current variable set.  */
     
    215220
    216221#define warn_undefined(n,l) do{\
    217                               if (warn_undefined_variables_flag) \
    218                                 error (reading_file, \
    219                                        _("warning: undefined variable `%.*s'"), \
    220                                 (int)(l), (n)); \
     222                              if (warn_undefined_variables_flag)        \
     223                                error (reading_file, (l),               \
     224                                       _("warning: undefined variable '%.*s'"), \
     225                                       (int)(l), (n));                  \
    221226                              }while(0)
    222227
     
    229234
    230235#define MAKELEVEL_NAME "MAKELEVEL"
    231 #define MAKELEVEL_LENGTH (sizeof (MAKELEVEL_NAME) - 1)
     236#define MAKELEVEL_LENGTH (CSTRLEN (MAKELEVEL_NAME))
Note: See TracChangeset for help on using the changeset viewer.