8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / cmd / make / bin / depvar.cc
blob4f348a5b779570ca5ee2ab79660b39dc952e04f2
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
22 * Copyright 1995 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
27 * Included files
29 #include <libintl.h>
31 #include <mk/defs.h>
32 #include <mksh/misc.h> /* getmem() */
35 * This file deals with "Dependency Variables".
36 * The "-V var" command line option is used to indicate
37 * that var is a dependency variable. Used in conjunction with
38 * the -P option the user is asking if the named variables affect
39 * the dependencies of the given target.
42 struct _Depvar {
43 Name name; /* Name of variable */
44 struct _Depvar *next; /* Linked list */
45 Boolean cmdline; /* Macro defined on the cmdline? */
48 typedef struct _Depvar *Depvar;
50 static Depvar depvar_list;
51 static Depvar *bpatch = &depvar_list;
52 static Boolean variant_deps;
55 * Add a name to the list.
58 void
59 depvar_add_to_list(Name name, Boolean cmdline)
61 Depvar dv;
63 dv = ALLOC(Depvar);
64 dv->name = name;
65 dv->next = NULL;
66 dv->cmdline = cmdline;
67 *bpatch = dv;
68 bpatch = &dv->next;
72 * The macro `name' has been used in either the left-hand or
73 * right-hand side of a dependency. See if it is in the
74 * list. Two things are looked for. Names given as args
75 * to the -V list are checked so as to set the same/differ
76 * output for the -P option. Names given as macro=value
77 * command-line args are checked and, if found, an NSE
78 * warning is produced.
80 void
81 depvar_dep_macro_used(Name name)
83 Depvar dv;
85 for (dv = depvar_list; dv != NULL; dv = dv->next) {
86 if (name == dv->name) {
87 variant_deps = true;
88 break;
95 * Print the results. If any of the Dependency Variables
96 * affected the dependencies then the dependencies potentially
97 * differ because of these variables.
99 void
100 depvar_print_results(void)
102 if (variant_deps) {
103 printf(gettext("differ\n"));
104 } else {
105 printf(gettext("same\n"));