1 /* $NetBSD: make.h,v 1.263 2021/06/21 10:33:11 rillig Exp $ */
4 * Copyright (c) 1988, 1989, 1990, 1993
5 * The Regents of the University of California. All rights reserved.
7 * This code is derived from software contributed to Berkeley by
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of the University nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * from: @(#)make.h 8.3 (Berkeley) 6/13/95
38 * Copyright (c) 1989 by Berkeley Softworks
39 * All rights reserved.
41 * This code is derived from software contributed to Berkeley by
44 * Redistribution and use in source and binary forms, with or without
45 * modification, are permitted provided that the following conditions
47 * 1. Redistributions of source code must retain the above copyright
48 * notice, this list of conditions and the following disclaimer.
49 * 2. Redistributions in binary form must reproduce the above copyright
50 * notice, this list of conditions and the following disclaimer in the
51 * documentation and/or other materials provided with the distribution.
52 * 3. All advertising materials mentioning features or use of this software
53 * must display the following acknowledgement:
54 * This product includes software developed by the University of
55 * California, Berkeley and its contributors.
56 * 4. Neither the name of the University nor the names of its contributors
57 * may be used to endorse or promote products derived from this software
58 * without specific prior written permission.
60 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
61 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
62 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
63 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
64 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
65 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
66 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
67 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
68 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
69 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
72 * from: @(#)make.h 8.3 (Berkeley) 6/13/95
77 * The global definitions for pmake
87 #include <sys/types.h>
88 #include <sys/param.h>
103 #include <sys/cdefs.h>
109 #if defined(__GNUC__)
110 #define MAKE_GNUC_PREREQ(x, y) \
111 ((__GNUC__ == (x) && __GNUC_MINOR__ >= (y)) || \
113 #else /* defined(__GNUC__) */
114 #define MAKE_GNUC_PREREQ(x, y) 0
115 #endif /* defined(__GNUC__) */
117 #if MAKE_GNUC_PREREQ(2, 7)
118 #define MAKE_ATTR_UNUSED __attribute__((__unused__))
120 #define MAKE_ATTR_UNUSED /* delete */
123 #if MAKE_GNUC_PREREQ(2, 5)
124 #define MAKE_ATTR_DEAD __attribute__((__noreturn__))
125 #elif defined(__GNUC__)
126 #define MAKE_ATTR_DEAD __volatile
128 #define MAKE_ATTR_DEAD /* delete */
131 #if MAKE_GNUC_PREREQ(2, 7)
132 #define MAKE_ATTR_PRINTFLIKE(fmtarg, firstvararg) \
133 __attribute__((__format__ (__printf__, fmtarg, firstvararg)))
135 #define MAKE_ATTR_PRINTFLIKE(fmtarg, firstvararg) /* delete */
138 #define MAKE_INLINE static inline MAKE_ATTR_UNUSED
139 #define MAKE_STATIC static MAKE_ATTR_UNUSED
141 #if __STDC_VERSION__ >= 199901L || defined(lint) || defined(USE_C99_BOOLEAN)
145 typedef unsigned int Boolean;
158 #include "make_malloc.h"
161 #include "make-conf.h"
165 * some vendors don't have this --sjg
167 #if defined(S_IFDIR) && !defined(S_ISDIR)
168 # define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
171 #if defined(sun) && (defined(__svr4__) || defined(__SVR4))
172 # define POSIX_SIGNALS
176 * The typical flow of states is:
178 * The direct successful path:
179 * UNMADE -> BEINGMADE -> MADE.
181 * The direct error path:
182 * UNMADE -> BEINGMADE -> ERROR.
184 * The successful path when dependencies need to be made first:
185 * UNMADE -> DEFERRED -> REQUESTED -> BEINGMADE -> MADE.
187 * A node that has dependencies, and one of the dependencies cannot be made:
188 * UNMADE -> DEFERRED -> ABORTED.
190 * A node that turns out to be up-to-date:
191 * UNMADE -> BEINGMADE -> UPTODATE.
193 typedef enum GNodeMade {
194 /* Not examined yet. */
196 /* The node has been examined but is not yet ready since its
197 * dependencies have to be made first. */
200 /* The node is on the toBeMade list. */
203 /* The node is already being made. Trying to build a node in this
204 * state indicates a cycle in the graph. */
207 /* Was out-of-date and has been made. */
209 /* Was already up-to-date, does not need to be made. */
211 /* An error occurred while it was being made.
212 * Used only in compat mode. */
214 /* The target was aborted due to an error making a dependency.
215 * Used only in compat mode. */
220 * The OP_ constants are used when parsing a dependency line as a way of
221 * communicating to other parts of the program the way in which a target
224 * Some of the OP_ constants can be combined, others cannot.
226 * See the tests depsrc-*.mk and deptgt-*.mk.
228 typedef enum GNodeType {
231 /* The dependency operator ':' is the most common one. The commands
232 * of this node are executed if any child is out-of-date. */
234 /* The dependency operator '!' always executes its commands, even if
235 * its children are up-to-date. */
237 /* The dependency operator '::' behaves like ':', except that it
238 * allows multiple dependency groups to be defined. Each of these
239 * groups is executed on its own, independently from the others.
240 * Each individual dependency group is called a cohort. */
241 OP_DOUBLEDEP = 1 << 2,
243 /* Matches the dependency operators ':', '!' and '::'. */
244 OP_OPMASK = OP_DEPENDS | OP_FORCE | OP_DOUBLEDEP,
246 /* Don't care if the target doesn't exist and can't be created. */
247 OP_OPTIONAL = 1 << 3,
248 /* Use associated commands for parents. */
250 /* Target is never out of date, but always execute commands anyway.
251 * Its time doesn't matter, so it has none...sort of. */
253 /* Ignore non-zero exit status from shell commands when creating the
256 /* Don't remove the target when interrupted. */
257 OP_PRECIOUS = 1 << 7,
258 /* Don't echo commands when executed. */
260 /* Target is a recursive make so its commands should always be
261 * executed when it is out of date, regardless of the state of the
264 /* Target is out-of-date only if any of its children was out-of-date. */
266 /* Assume the children of the node have been already made. */
268 /* Special .BEGIN, .END or .INTERRUPT. */
269 OP_SPECIAL = 1 << 12,
270 /* Like .USE, only prepend commands. */
271 OP_USEBEFORE = 1 << 13,
272 /* The node is invisible to its parents. I.e. it doesn't show up in
273 * the parents' local variables (.IMPSRC, .ALLSRC). */
274 OP_INVISIBLE = 1 << 14,
275 /* The node does not become the main target, even if it is the first
276 * target in the first makefile. */
277 OP_NOTMAIN = 1 << 15,
278 /* Not a file target; run always. */
280 /* Don't search for the file in the path. */
282 /* In a dependency line "target: source1 .WAIT source2", source1 is
283 * made first, including its children. Once that is finished,
284 * source2 is made, including its children. The .WAIT keyword may
285 * appear more than once in a single dependency declaration. */
287 /* .NOMETA do not create a .meta file */
289 /* .META we _do_ want a .meta file */
291 /* Do not compare commands in .meta file */
292 OP_NOMETA_CMP = 1 << 21,
293 /* Possibly a submake node */
294 OP_SUBMAKE = 1 << 22,
296 /* Attributes applied by PMake */
298 /* The node is a transformation rule, such as ".c.o". */
299 OP_TRANSFORM = 1 << 30,
300 /* Target is a member of an archive */
301 /* XXX: How does this differ from OP_ARCHV? */
303 /* The node is a library,
304 * its name has the form "-l<libname>" */
306 /* The node is an archive member,
307 * its name has the form "archive(member)" */
308 /* XXX: How does this differ from OP_MEMBER? */
310 /* Target has all the commands it should. Used when parsing to catch
311 * multiple command groups for a target. Only applies to the
312 * dependency operators ':' and '!', but not to '::'. */
313 OP_HAS_COMMANDS = 1 << 26,
314 /* The special command "..." has been seen. All further commands from
315 * this node will be saved on the .END node instead, to be executed at
317 OP_SAVE_CMDS = 1 << 25,
318 /* Already processed by Suff_FindDeps, to find dependencies from
319 * suffix transformation rules. */
320 OP_DEPS_FOUND = 1 << 24,
321 /* Node found while expanding .ALLSRC */
324 OP_NOTARGET = OP_NOTMAIN | OP_USE | OP_EXEC | OP_TRANSFORM
327 typedef enum GNodeFlags {
329 /* this target needs to be (re)made */
331 /* children of this target were made */
333 /* children don't exist, and we pretend made */
335 /* Set by Make_ProcessWait() */
337 /* Build requested by .ORDER processing */
339 /* Node created from .depend */
340 FROM_DEPEND = 1 << 5,
341 /* We do it once only */
342 DONE_ALLSRC = 1 << 6,
343 /* Used by MakePrintStatus */
345 /* Used by MakePrintStatus */
349 typedef struct List StringList;
350 typedef struct ListNode StringListNode;
352 typedef struct List GNodeList;
353 typedef struct ListNode GNodeListNode;
355 typedef struct SearchPath {
356 List /* of CachedDir */ dirs;
360 * A graph node represents a target that can possibly be made, including its
361 * relation to other targets and a lot of other details.
363 typedef struct GNode {
364 /* The target's name, such as "clean" or "make.c" */
366 /* The unexpanded name of a .USE node */
368 /* The full pathname of the file belonging to the target.
369 * XXX: What about .PHONY targets? These don't have an associated
373 /* The type of operator used to define the sources (see the OP flags
375 * XXX: This looks like a wild mixture of type and flags. */
379 /* The state of processing on this node */
381 /* The number of unmade children */
384 /* The modification time; 0 means the node does not have a
385 * corresponding file; see GNode_IsOODate. */
387 struct GNode *youngestChild;
389 /* The GNodes for which this node is an implied source. May be empty.
390 * For example, when there is an inference rule for .c.o, the node for
391 * file.c has the node for file.o in this list. */
392 GNodeList implicitParents;
394 /* The nodes that depend on this one, or in other words, the nodes for
395 * which this is a source. */
397 /* The nodes on which this one depends. */
400 /* .ORDER nodes we need made. The nodes that must be made (if they're
401 * made) before this node can be made, but that do not enter into the
402 * datedness of this node. */
403 GNodeList order_pred;
404 /* .ORDER nodes who need us. The nodes that must be made (if they're
405 * made at all) after this node is made, but that do not depend on
406 * this node, in the normal sense. */
407 GNodeList order_succ;
410 * Other nodes of the same name, for targets that were defined using
411 * the '::' dependency operator (OP_DOUBLEDEP).
414 /* The "#n" suffix for this cohort, or "" for other nodes */
416 /* The number of unmade instances on the cohorts list */
418 /* Pointer to the first instance of a '::' node; only set when on a
420 struct GNode *centurion;
422 /* Last time (sequence number) we tried to make this node */
423 unsigned int checked_seqno;
426 * The "local" variables that are specific to this target and this
427 * target only, such as $@, $<, $?.
429 * Also used for the global variable scopes SCOPE_GLOBAL,
430 * SCOPE_CMDLINE, SCOPE_INTERNAL, which contain variables with
433 HashTable /* of Var pointer */ vars;
435 /* The commands to be given to a shell to create this target. */
438 /* Suffix for the node (determined by Suff_FindDeps and opaque to
439 * everyone but the Suff module) */
440 struct Suffix *suffix;
442 /* Filename where the GNode got defined */
443 /* XXX: What is the lifetime of this string? */
445 /* Line number where the GNode got defined */
449 /* Error levels for diagnostics during parsing. */
450 typedef enum ParseErrorLevel {
451 /* Exit when the current top-level makefile has been parsed
454 /* Print "warning"; may be upgraded to fatal by the -w option. */
456 /* Informational, mainly used during development of makefiles. */
461 * Values returned by Cond_EvalLine and Cond_EvalCondition.
463 typedef enum CondEvalResult {
464 COND_PARSE, /* Parse the next lines */
465 COND_SKIP, /* Skip the next lines */
466 COND_INVALID /* Not a conditional statement */
469 /* Names of the variables that are "local" to a specific target. */
470 #define TARGET "@" /* Target of dependency */
471 #define OODATE "?" /* All out-of-date sources */
472 #define ALLSRC ">" /* All sources */
473 #define IMPSRC "<" /* Source implied by transformation */
474 #define PREFIX "*" /* Common prefix */
475 #define ARCHIVE "!" /* Archive in "archive(member)" syntax */
476 #define MEMBER "%" /* Member in "archive(member)" syntax */
482 /* True if every target is precious */
483 extern bool allPrecious;
484 /* True if failed targets should be deleted */
485 extern bool deleteOnError;
486 /* true while processing .depend */
487 extern bool doing_depend;
489 extern GNode *defaultNode;
492 * Variables defined internally by make which should not override those set
495 extern GNode *SCOPE_INTERNAL;
496 /* Variables defined in a global scope, e.g in the makefile itself. */
497 extern GNode *SCOPE_GLOBAL;
498 /* Variables defined on the command line. */
499 extern GNode *SCOPE_CMDLINE;
502 * Value returned by Var_Parse when an error is encountered. It actually
503 * points to an empty string, so naive callers needn't worry about it.
505 extern char var_Error[];
507 /* The time at the start of this whole process */
511 * The list of directories to search when looking for targets (set by the
512 * special target .PATH).
514 extern SearchPath dirSearchPath;
515 /* Used for .include "...". */
516 extern SearchPath *parseIncPath;
518 * Used for .include <...>, for the built-in sys.mk and for makefiles from
519 * the command line arguments.
521 extern SearchPath *sysIncPath;
522 /* The default for sysIncPath. */
523 extern SearchPath *defSysIncPath;
525 /* Startup directory */
526 extern char curdir[];
527 /* The basename of the program name, suffixed with [n] for sub-makes. */
528 extern const char *progname;
529 extern int makelevel;
530 /* Name of the .depend makefile */
531 extern char *makeDependfile;
532 /* If we replaced environ, this will be non-NULL. */
533 extern char **savedEnv;
537 #define MAKEFLAGS ".MAKEFLAGS"
538 #define MAKEOVERRIDES ".MAKEOVERRIDES"
539 /* prefix when printing the target of a job */
540 #define MAKE_JOB_PREFIX ".MAKE.JOB.PREFIX"
541 #define MAKE_EXPORTED ".MAKE.EXPORTED" /* exported variables */
542 #define MAKE_MAKEFILES ".MAKE.MAKEFILES" /* all loaded makefiles */
543 #define MAKE_LEVEL ".MAKE.LEVEL" /* recursion level */
544 #define MAKE_MAKEFILE_PREFERENCE ".MAKE.MAKEFILE_PREFERENCE"
545 #define MAKE_DEPENDFILE ".MAKE.DEPENDFILE" /* .depend */
546 #define MAKE_MODE ".MAKE.MODE"
547 #ifndef MAKE_LEVEL_ENV
548 # define MAKE_LEVEL_ENV "MAKELEVEL"
551 typedef enum DebugFlags {
557 DEBUG_ERROR = 1 << 4,
559 DEBUG_GRAPH1 = 1 << 6,
560 DEBUG_GRAPH2 = 1 << 7,
561 DEBUG_GRAPH3 = 1 << 8,
564 DEBUG_LOUD = 1 << 11,
565 DEBUG_MAKE = 1 << 12,
566 DEBUG_META = 1 << 13,
567 DEBUG_PARSE = 1 << 14,
568 DEBUG_SCRIPT = 1 << 15,
569 DEBUG_SHELL = 1 << 16,
570 DEBUG_SUFF = 1 << 17,
571 DEBUG_TARG = 1 << 18,
573 DEBUG_ALL = (1 << 20) - 1
576 #define CONCAT(a, b) a##b
578 #define DEBUG(module) ((opts.debug & CONCAT(DEBUG_, module)) != 0)
580 void debug_printf(const char *, ...) MAKE_ATTR_PRINTFLIKE(1, 2);
582 #define DEBUG_IMPL(module, args) \
586 } while (/*CONSTCOND*/false)
588 #define DEBUG0(module, text) \
589 DEBUG_IMPL(module, ("%s", text))
590 #define DEBUG1(module, fmt, arg1) \
591 DEBUG_IMPL(module, (fmt, arg1))
592 #define DEBUG2(module, fmt, arg1, arg2) \
593 DEBUG_IMPL(module, (fmt, arg1, arg2))
594 #define DEBUG3(module, fmt, arg1, arg2, arg3) \
595 DEBUG_IMPL(module, (fmt, arg1, arg2, arg3))
596 #define DEBUG4(module, fmt, arg1, arg2, arg3, arg4) \
597 DEBUG_IMPL(module, (fmt, arg1, arg2, arg3, arg4))
598 #define DEBUG5(module, fmt, arg1, arg2, arg3, arg4, arg5) \
599 DEBUG_IMPL(module, (fmt, arg1, arg2, arg3, arg4, arg5))
601 typedef enum PrintVarsMode {
607 /* Command line options */
608 typedef struct CmdOpts {
609 /* -B: whether we are make compatible */
612 /* -d: debug control: There is one bit per module. It is up to the
613 * module what debug information to print. */
616 /* -df: debug output is written here - default stderr */
621 * Runs make in strict mode, with additional checks and better error
625 /* -dV: for the -V option, print unexpanded variable values */
628 /* -e: check environment variables before global variables */
631 /* -f: the makefiles to read */
632 StringList makefiles;
634 /* -i: if true, ignore all errors from shell commands */
637 /* -j: the maximum number of jobs that can run in parallel;
638 * this is coordinated with the submakes */
641 /* -k: if true and an error occurs while making a node, continue
642 * making nodes that do not depend on the erroneous node */
645 /* -N: execute no commands from the targets */
646 bool noRecursiveExecute;
648 /* -n: execute almost no commands from the targets */
652 * -q: if true, do not really make anything, just see if the targets
657 /* -r: raw mode, do not load the builtin rules. */
660 /* -s: don't echo the shell commands before executing them */
663 /* -t: touch the targets if they are out-of-date, but don't actually
667 /* -[Vv]: print expanded or unexpanded selected variables */
668 PrintVarsMode printVars;
669 /* -[Vv]: the variables to print */
670 StringList variables;
672 /* -W: if true, makefile parsing warnings are treated as errors */
675 /* -w: print 'Entering' and 'Leaving' for submakes */
678 /* -X: if true, do not export variables set on the command line to the
682 /* The target names specified on the command line.
683 * Used to resolve .if make(...) statements. */
692 void GNode_UpdateYoungestChild(GNode *, GNode *);
693 bool GNode_IsOODate(GNode *);
694 void Make_ExpandUse(GNodeList *);
695 time_t Make_Recheck(GNode *);
696 void Make_HandleUse(GNode *, GNode *);
697 void Make_Update(GNode *);
698 void GNode_SetLocalVars(GNode *);
699 bool Make_Run(GNodeList *);
700 bool shouldDieQuietly(GNode *, int);
701 void PrintOnError(GNode *, const char *);
702 void Main_ExportMAKEFLAGS(bool);
703 bool Main_SetObjdir(bool, const char *, ...) MAKE_ATTR_PRINTFLIKE(2, 3);
704 int mkTempFile(const char *, char *, size_t);
705 int str2Lst_Append(StringList *, char *);
706 void GNode_FprintDetails(FILE *, const char *, const GNode *, const char *);
707 bool GNode_ShouldExecute(GNode *gn);
709 /* See if the node was seen on the left-hand side of a dependency operator. */
711 GNode_IsTarget(const GNode *gn)
713 return (gn->type & OP_OPMASK) != 0;
716 MAKE_INLINE const char *
717 GNode_Path(const GNode *gn)
719 return gn->path != NULL ? gn->path : gn->name;
723 GNode_IsWaitingFor(const GNode *gn)
725 return (gn->flags & REMAKE) && gn->made <= REQUESTED;
729 GNode_IsReady(const GNode *gn)
731 return gn->made > DEFERRED;
735 GNode_IsDone(const GNode *gn)
737 return gn->made >= MADE;
741 GNode_IsError(const GNode *gn)
743 return gn->made == ERROR || gn->made == ABORTED;
746 MAKE_INLINE const char *
747 GNode_VarTarget(GNode *gn) { return GNode_ValueDirect(gn, TARGET); }
748 MAKE_INLINE const char *
749 GNode_VarOodate(GNode *gn) { return GNode_ValueDirect(gn, OODATE); }
750 MAKE_INLINE const char *
751 GNode_VarAllsrc(GNode *gn) { return GNode_ValueDirect(gn, ALLSRC); }
752 MAKE_INLINE const char *
753 GNode_VarImpsrc(GNode *gn) { return GNode_ValueDirect(gn, IMPSRC); }
754 MAKE_INLINE const char *
755 GNode_VarPrefix(GNode *gn) { return GNode_ValueDirect(gn, PREFIX); }
756 MAKE_INLINE const char *
757 GNode_VarArchive(GNode *gn) { return GNode_ValueDirect(gn, ARCHIVE); }
758 MAKE_INLINE const char *
759 GNode_VarMember(GNode *gn) { return GNode_ValueDirect(gn, MEMBER); }
761 #if defined(__GNUC__) && __STDC_VERSION__ >= 199901L
762 #define UNCONST(ptr) ({ \
767 __d.__cp = ptr, __d.__p; })
769 #define UNCONST(ptr) (void *)(ptr)
772 /* At least GNU/Hurd systems lack hardcoded MAXPATHLEN/PATH_MAX */
777 #define MAXPATHLEN BMAKE_PATH_MAX
780 #define PATH_MAX MAXPATHLEN
784 #define KILLPG(pid, sig) kill(-(pid), (sig))
786 #define KILLPG(pid, sig) killpg((pid), (sig))
790 ch_isalnum(char ch) { return isalnum((unsigned char)ch) != 0; }
792 ch_isalpha(char ch) { return isalpha((unsigned char)ch) != 0; }
794 ch_isdigit(char ch) { return isdigit((unsigned char)ch) != 0; }
796 ch_isspace(char ch) { return isspace((unsigned char)ch) != 0; }
798 ch_isupper(char ch) { return isupper((unsigned char)ch) != 0; }
800 ch_tolower(char ch) { return (char)tolower((unsigned char)ch); }
802 ch_toupper(char ch) { return (char)toupper((unsigned char)ch); }
805 cpp_skip_whitespace(const char **pp)
807 while (ch_isspace(**pp))
812 cpp_skip_hspace(const char **pp)
814 while (**pp == ' ' || **pp == '\t')
819 pp_skip_whitespace(char **pp)
821 while (ch_isspace(**pp))
826 pp_skip_hspace(char **pp)
828 while (**pp == ' ' || **pp == '\t')
833 # define MAKE_RCSID(id) extern void do_not_define_rcsid(void)
834 #elif defined(MAKE_NATIVE)
835 # include <sys/cdefs.h>
836 # define MAKE_RCSID(id) __RCSID(id)
837 #elif defined(MAKE_ALL_IN_ONE) && defined(__COUNTER__)
838 # define MAKE_RCSID_CONCAT(x, y) CONCAT(x, y)
839 # define MAKE_RCSID(id) static volatile char \
840 MAKE_RCSID_CONCAT(rcsid_, __COUNTER__)[] = id
841 #elif defined(MAKE_ALL_IN_ONE)
842 # define MAKE_RCSID(id) extern void do_not_define_rcsid(void)
844 # define MAKE_RCSID(id) static volatile char rcsid[] = id
847 #endif /* MAKE_MAKE_H */