summaryrefslogtreecommitdiff
path: root/rule.h
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2007-03-20 03:02:26 +0000
committerPaul Smith <psmith@gnu.org>2007-03-20 03:02:26 +0000
commit6ccf33cdbdfda2aea5d51e4d4991881c74d853d1 (patch)
treece963770c6d0dc0428a6bce65d96da4b710e2831 /rule.h
parente4da30858037b431880263676e8f90b1f8412a38 (diff)
downloadgunmake-6ccf33cdbdfda2aea5d51e4d4991881c74d853d1.tar.gz
This is a major update, which switches virtually every allocated-but-not-freed
string into the strcache. As a side-effect, many more structure members and function arguments can/should be declared const. As mentioned in the changelog, unfortunately measurement shows that this change does not yet reduce memory. The problem is with secondary expansion: because of this we store all the prerequisites in the string cache twice. First we store the prerequisite string after initial expansion but before secondary expansion, then we store each individual file after secondary expansion and expand_deps(). I plan to change expand_deps() to be callable in either context (eval or snap_deps) then have non-second-expansion targets call expand_deps() during eval, so that we only need to store that dependency list once.
Diffstat (limited to 'rule.h')
-rw-r--r--rule.h15
1 files changed, 8 insertions, 7 deletions
diff --git a/rule.h b/rule.h
index 91378f6..16b4d51 100644
--- a/rule.h
+++ b/rule.h
@@ -16,16 +16,18 @@ You should have received a copy of the GNU General Public License along with
GNU Make; see the file COPYING. If not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. */
-/* Structure used for pattern rules. */
+
+/* Structure used for pattern (implicit) rules. */
struct rule
{
struct rule *next;
- char **targets; /* Targets of the rule. */
+ const char **targets; /* Targets of the rule. */
unsigned int *lens; /* Lengths of each target. */
- char **suffixes; /* Suffixes (after `%') of each target. */
+ const char **suffixes; /* Suffixes (after `%') of each target. */
struct dep *deps; /* Dependencies of the rule. */
struct commands *cmds; /* Commands to execute. */
+ unsigned short num; /* Number of targets. */
char terminal; /* If terminal (double-colon). */
char in_use; /* If in use by a parent pattern_search. */
};
@@ -49,10 +51,9 @@ extern struct file *suffix_file;
extern unsigned int maxsuffix;
-void install_pattern_rule (struct pspec *p, int terminal);
-int new_pattern_rule (struct rule *rule, int override);
void count_implicit_rule_limits (void);
void convert_to_pattern (void);
-void create_pattern_rule (char **targets, char **target_percents,
- int terminal, struct dep *deps,
+void install_pattern_rule (struct pspec *p, int terminal);
+void create_pattern_rule (const char **targets, const char **target_percents,
+ unsigned int num, int terminal, struct dep *deps,
struct commands *commands, int override);