PIPS
activate_extensions_bc.c File Reference

Go to the source code of this file.

Functions

static bool rule_multi_produced_consistent_p (rule mp_rule, makefile make_file)
 static bool rule_multi_produced_consistent_p(rule mp_rule, makefile make_file) input : a rule that produces more than one resource and a the current makefile output : true if the others rules of the make file that produce at least one of the resource that mp_rule produces, produce exactly the same resources, or if no other rule produces the same resources. More...
 
static bool rule_produced_consistent_p (rule rule_1, rule rule_2)
 static bool rule_produced_consistent_p(rule rule_1, rule_2) input : two rules output : true if they produce exactly the same resources, or if they produce no common resource. More...
 

Function Documentation

◆ rule_multi_produced_consistent_p()

static bool rule_multi_produced_consistent_p ( rule  mp_rule,
makefile  make_file 
)
static

static bool rule_multi_produced_consistent_p(rule mp_rule, makefile make_file) input : a rule that produces more than one resource and a the current makefile output : true if the others rules of the make file that produce at least one of the resource that mp_rule produces, produce exactly the same resources, or if no other rule produces the same resources.

false otherwise. modifies : nothing comment :

Definition at line 36 of file activate_extensions_bc.c.

39 {
40  static bool rule_produced_consistent_p(rule rule_1, rule rule_2);
41  list all_rules = makefile_rules(make_file);
42  rule c_rule = rule_undefined;
43  bool consistent = true;
44 
45 
46  while (consistent && !ENDP(all_rules)) {
47  c_rule = RULE(CAR(all_rules));
48 
49  if ( (c_rule != mp_rule)
50  && !rule_produced_consistent_p(mp_rule, c_rule))
51  consistent = false;
52  all_rules = CDR(all_rules);
53  }
54 
55  return(consistent);
56 
57 }
static bool rule_produced_consistent_p(rule rule_1, rule rule_2)
static bool rule_produced_consistent_p(rule rule_1, rule_2) input : two rules output : true if they p...
#define ENDP(l)
Test if a list is empty.
Definition: newgen_list.h:66
#define CAR(pcons)
Get the value of the first element of a list.
Definition: newgen_list.h:92
#define CDR(pcons)
Get the list less its first element.
Definition: newgen_list.h:111
#define RULE(x)
RULE.
Definition: makefile.h:209
#define rule_undefined
Definition: makefile.h:215
#define makefile_rules(x)
Definition: makefile.h:82
The structure used to build lists in NewGen.
Definition: newgen_list.h:41

References CAR, CDR, ENDP, makefile_rules, RULE, rule_produced_consistent_p(), and rule_undefined.

+ Here is the call graph for this function:

◆ rule_produced_consistent_p()

static bool rule_produced_consistent_p ( rule  rule_1,
rule  rule_2 
)
static

static bool rule_produced_consistent_p(rule rule_1, rule_2) input : two rules output : true if they produce exactly the same resources, or if they produce no common resource.

false otherwise. modifies : nothing. comment :

Definition at line 67 of file activate_extensions_bc.c.

69 {
70  list l_prod1 = rule_produced(rule_1);
71  list l_prod2 = rule_produced(rule_2);
72  list l2;
73  bool consistent = true;
74  bool first_common = true;
75  bool first = true;
76  bool same_length = (gen_length(l_prod1) == gen_length(l_prod2));
77  string vr1, vr2;
78 
79  while (consistent && !ENDP(l_prod1)) {
80 
81  bool found = false;
83  l2 = l_prod2;
84 
85  while (!found && !ENDP(l2)) {
87  if (same_string_p(vr1,vr2))
88  found = true;
89  else
90  l2 = CDR(l2);
91  }
92 
93 
94  if (first && !found ) first_common = false;
95  if (first) first = false;
96 
97  consistent = (first_common && found && same_length) || (!first_common && !found);
98 
99  l_prod1 = CDR(l_prod1);
100  }
101  return(consistent);
102 }
size_t gen_length(const list l)
Definition: list.c:150
#define virtual_resource_name(x)
Definition: makefile.h:290
#define rule_produced(x)
Definition: makefile.h:248
#define VIRTUAL_RESOURCE(x)
VIRTUAL_RESOURCE.
Definition: makefile.h:260
#define same_string_p(s1, s2)

References CAR, CDR, ENDP, gen_length(), rule_produced, same_string_p, VIRTUAL_RESOURCE, and virtual_resource_name.

Referenced by rule_multi_produced_consistent_p().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: