VirtualBox

Changeset 3140 in kBuild for trunk/src/kmk/dep.h


Ignore:
Timestamp:
Mar 14, 2018 9:28:10 PM (7 years ago)
Author:
bird
Message:

kmk: Merged in changes from GNU make 4.2.1 (2e55f5e4abdc0e38c1d64be703b446695e70b3b6 / https://git.savannah.gnu.org/git/make.git).

Location:
trunk/src/kmk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk

  • trunk/src/kmk/dep.h

    r2591 r3140  
    11/* Definitions of dependency data structures for 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
     
    1715this program.  If not, see <http://www.gnu.org/licenses/>.  */
    1816
    19 /* Flag bits for the second argument to `read_makefile'.
    20    These flags are saved in the `changed' field of each
    21    `struct dep' in the chain returned by `read_all_makefiles'.  */
    2217
    23 #define RM_NO_DEFAULT_GOAL      (1 << 0) /* Do not set default goal.  */
    24 #define RM_INCLUDED             (1 << 1) /* Search makefile search path.  */
    25 #define RM_DONTCARE             (1 << 2) /* No error if it doesn't exist.  */
    26 #define RM_NO_TILDE             (1 << 3) /* Don't expand ~ in file name.  */
    27 #define RM_NOFLAG               0
     18/* Structure used in chains of names, for parsing and globbing.  */
     19
     20#define NAMESEQ(_t)     \
     21    _t *next;           \
     22    const char *name
     23
     24struct nameseq
     25  {
     26    NAMESEQ (struct nameseq);
     27  };
     28
     29/* Flag bits for the second argument to 'read_makefile'.
     30   These flags are saved in the 'flags' field of each
     31   'struct goaldep' in the chain returned by 'read_all_makefiles'.  */
     32
     33#define RM_NO_DEFAULT_GOAL      (1 << 0) /* Do not set default goal.  */
     34#define RM_INCLUDED             (1 << 1) /* Search makefile search path.  */
     35#define RM_DONTCARE             (1 << 2) /* No error if it doesn't exist.  */
     36#define RM_NO_TILDE             (1 << 3) /* Don't expand ~ in file name.  */
     37#define RM_NOFLAG               0
    2838
    2939/* Structure representing one dependency of a file.
    30    Each struct file's `deps' points to a chain of these,
    31    chained through the `next'. `stem' is the stem for this
    32    dep line of static pattern rule or NULL.
     40   Each struct file's 'deps' points to a chain of these, through 'next'.
     41   'stem' is the stem for this dep line of static pattern rule or NULL.  */
    3342
    34    Note that the first two words of this match a struct nameseq.  */
     43#ifndef CONFIG_WITH_INCLUDEDEP
     44#define DEP(_t)                                 \
     45    NAMESEQ (_t);                               \
     46    struct file *file;                          \
     47    const char *stem;                           \
     48    unsigned short flags : 8;                   \
     49    unsigned short changed : 1;                 \
     50    unsigned short ignore_mtime : 1;            \
     51    unsigned short staticpattern : 1;           \
     52    unsigned short need_2nd_expansion : 1
     53#else
     54# define DEP(_t)                                \
     55    NAMESEQ (_t);                               \
     56    struct file *file;                          \
     57    const char *stem;                           \
     58    unsigned short flags : 8;                   \
     59    unsigned short changed : 1;                 \
     60    unsigned short ignore_mtime : 1;            \
     61    unsigned short staticpattern : 1;           \
     62    unsigned short need_2nd_expansion : 1;      \
     63    unsigned short includedep : 1
     64#endif
    3565
    3666struct dep
    3767  {
    38     struct dep *next;
    39     const char *name;
    40     const char *stem;
    41     struct file *file;
    42     unsigned int changed : 8;
    43     unsigned int ignore_mtime : 1;
    44     unsigned int staticpattern : 1;
    45     unsigned int need_2nd_expansion : 1;
    46     unsigned int dontcare : 1;
    47 
    48 #ifdef CONFIG_WITH_INCLUDEDEP
    49     unsigned int includedep : 1;
    50 #endif
     68    DEP (struct dep);
    5169  };
    5270
     71/* Structure representing one goal.
     72   The goals to be built constitute a chain of these, chained through 'next'.
     73   'stem' is not used, but it's simpler to include and ignore it.  */
    5374
    54 /* Structure used in chains of names, for parsing and globbing.  */
    55 
    56 struct nameseq
     75struct goaldep
    5776  {
    58     struct nameseq *next;
    59     const char *name;
     77    DEP (struct goaldep);
     78    unsigned short error;
     79    floc floc;
    6080  };
    6181
     82/* Options for parsing lists of filenames.  */
    6283
    63 #define PARSEFS_NONE    (0x0000)
    64 #define PARSEFS_NOSTRIP (0x0001)
    65 #define PARSEFS_NOAR    (0x0002)
    66 #define PARSEFS_NOGLOB  (0x0004)
    67 #define PARSEFS_EXISTS  (0x0008)
    68 #define PARSEFS_NOCACHE (0x0010)
     84#define PARSEFS_NONE    0x0000
     85#define PARSEFS_NOSTRIP 0x0001
     86#define PARSEFS_NOAR    0x0002
     87#define PARSEFS_NOGLOB  0x0004
     88#define PARSEFS_EXISTS  0x0008
     89#define PARSEFS_NOCACHE 0x0010
    6990
    7091#ifndef CONFIG_WITH_ALLOC_CACHES
    7192#define PARSE_FILE_SEQ(_s,_t,_c,_p,_f) \
    7293            (_t *)parse_file_seq ((_s),sizeof (_t),(_c),(_p),(_f))
     94#define PARSE_SIMPLE_SEQ(_s,_t) \
     95            (_t *)parse_file_seq ((_s),sizeof (_t),MAP_NUL,NULL,PARSEFS_NONE)
    7396#else
    7497# define PARSE_FILE_SEQ(_s,_t,_c,_p,_f) \
    7598            (_t *)parse_file_seq ((_s),sizeof (_t),(_c),(_p),(_f), \
    7699                                  &PARSE_FILE_SEQ_IGNORE_ ## _t ## _cache)
     100# define PARSE_SIMPLE_SEQ(_s,_t) \
     101            (_t *)parse_file_seq ((_s),sizeof (_t),MAP_NUL,NULL,PARSEFS_NONE, \
     102                                  &PARSE_FILE_SEQ_IGNORE_ ## _t ## _cache)
    77103# define PARSE_FILE_SEQ_IGNORE_struct
    78104#endif
     105
    79106
    80107#ifdef VMS
     
    82109#else
    83110void *parse_file_seq (char **stringp, unsigned int size,
    84                       int stopchar, const char *prefix, int flags
     111                      int stopmap, const char *prefix, int flags
    85112                      IF_WITH_ALLOC_CACHES_PARAM(struct alloccache *cache));
    86113#endif
     
    92119#endif
    93120
    94 #define dep_name(d)     ((d)->name == 0 ? (d)->file->name : (d)->name)
    95 
     121#define dep_name(d)        ((d)->name ? (d)->name : (d)->file->name)
    96122
    97123#ifndef CONFIG_WITH_ALLOC_CACHES
    98 #define alloc_dep()     (xcalloc (sizeof (struct dep)))
    99 #define free_ns(_n)     free (_n)
    100 #define free_dep(_d)    free_ns (_d)
     124
     125#define alloc_seq_elt(_t)   xcalloc (sizeof (_t))
     126void free_ns_chain (struct nameseq *n);
     127
     128#if defined(MAKE_MAINTAINER_MODE) && defined(__GNUC__)
     129/* Use inline to get real type-checking.  */
     130#define SI static inline
     131SI struct nameseq *alloc_ns()      { return alloc_seq_elt (struct nameseq); }
     132SI struct dep *alloc_dep()         { return alloc_seq_elt (struct dep); }
     133SI struct goaldep *alloc_goaldep() { return alloc_seq_elt (struct goaldep); }
     134
     135SI void free_ns(struct nameseq *n)      { free (n); }
     136SI void free_dep(struct dep *d)         { free_ns ((struct nameseq *)d); }
     137SI void free_goaldep(struct goaldep *g) { free_dep ((struct dep *)g); }
     138
     139SI void free_dep_chain(struct dep *d)      { free_ns_chain((struct nameseq *)d); }
     140SI void free_goal_chain(struct goaldep *g) { free_dep_chain((struct dep *)g); }
    101141#else
    102 #define alloc_dep()     alloccache_calloc (&dep_cache)
    103 #define free_ns(_n)     alloccache_free (&nameseq_cache, _n)
    104 #define free_dep(_d)    alloccache_free (&dep_cache, _d)
     142# define alloc_ns()          alloc_seq_elt (struct nameseq)
     143# define alloc_dep()         alloc_seq_elt (struct dep)
     144# define alloc_goaldep()     alloc_seq_elt (struct goaldep)
     145
     146# define free_ns(_n)         free (_n)
     147# define free_dep(_d)        free_ns (_d)
     148# define free_goaldep(_g)    free_dep (_g)
     149
     150# define free_dep_chain(_d)  free_ns_chain ((struct nameseq *)(_d))
     151# define free_goal_chain(_g) free_ns_chain ((struct nameseq *)(_g))
    105152#endif
    106153
     154#else /* CONFIG_WITH_ALLOC_CACHES */
     155
     156# include <k/kDefs.h>
     157
     158K_INLINE struct nameseq *alloc_ns (void)        { return (struct nameseq *)alloccache_calloc (&nameseq_cache); }
     159K_INLINE void free_ns (struct nameseq *n)       { alloccache_free (&nameseq_cache, n); }
     160void free_ns_chain (struct nameseq *n);
     161
     162K_INLINE struct dep *alloc_dep (void)           { return (struct dep *)alloccache_calloc (&dep_cache); }
     163K_INLINE void free_dep (struct dep *d)          { alloccache_free (&dep_cache, d); }
     164void free_dep_chain (struct dep *d);
     165
     166K_INLINE struct goaldep *alloc_goaldep (void)   { return (struct goaldep *)alloccache_calloc (&goaldep_cache); }
     167K_INLINE void free_goaldep (struct goaldep *g)  { alloccache_free (&goaldep_cache, g); }
     168void free_goal_chain (struct goaldep *g);
     169
     170#endif  /* CONFIG_WITH_ALLOC_CACHES */
     171
    107172struct dep *copy_dep_chain (const struct dep *d);
    108 void free_dep_chain (struct dep *d);
    109 void free_ns_chain (struct nameseq *n);
    110 struct dep *read_all_makefiles (const char **makefiles);
    111 void eval_buffer (char *buffer IF_WITH_VALUE_LENGTH(COMMA char *eos));
    112 int update_goal_chain (struct dep *goals);
     173
     174struct goaldep *read_all_makefiles (const char **makefiles);
     175void eval_buffer (char *buffer, const floc *floc IF_WITH_VALUE_LENGTH(COMMA char *eos));
     176enum update_status update_goal_chain (struct goaldep *goals);
    113177
    114178#ifdef CONFIG_WITH_INCLUDEDEP
    115179/* incdep.c */
    116180enum incdep_op { incdep_read_it, incdep_queue, incdep_flush };
    117 void eval_include_dep (const char *name, struct floc *f, enum incdep_op op);
     181void eval_include_dep (const char *name, floc *f, enum incdep_op op);
    118182void incdep_flush_and_term (void);
    119183#endif
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette