summaryrefslogtreecommitdiff
path: root/read.c
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2002-10-13 18:50:10 +0000
committerPaul Smith <psmith@gnu.org>2002-10-13 18:50:10 +0000
commit8bbdbb02b30ffd39c2fac9259b3a91cb62e1711d (patch)
tree19aedce81b831b1ad57c3b0fef27589070dc879c /read.c
parent47cd8d4624b60d3462991c436c961e0721cd278b (diff)
downloadgunmake-8bbdbb02b30ffd39c2fac9259b3a91cb62e1711d.tar.gz
Fix bug#1379: don't use alloca() where it could overrun the stack size.
Implemented enhancement #1391: allow "export" in target-specific variable definitions. Change the Info name of the "Automatic" node to "Automatic Variables". Add text clarifying the scope of automatic variables to that section.
Diffstat (limited to 'read.c')
-rw-r--r--read.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/read.c b/read.c
index 07bb11a..1d91647 100644
--- a/read.c
+++ b/read.c
@@ -139,6 +139,7 @@ static void record_files PARAMS ((struct nameseq *filenames, char *pattern, char
static void record_target_var PARAMS ((struct nameseq *filenames, char *defn,
int two_colon,
enum variable_origin origin,
+ int enabled,
const struct floc *flocp));
static enum make_word_type get_next_mword PARAMS ((char *buffer, char *delim,
char **startp, unsigned int *length));
@@ -860,6 +861,7 @@ eval (ebuf, set_default)
{
enum make_word_type wtype;
enum variable_origin v_origin;
+ int exported;
char *cmdleft, *semip, *lb_next;
unsigned int len, plen = 0;
char *colonp;
@@ -1024,17 +1026,24 @@ eval (ebuf, set_default)
p2 = variable_buffer + l;
}
- /* See if it's an "override" keyword; if so see if what comes after
- it looks like a variable definition. */
+ /* See if it's an "override" or "export" keyword; if so see if what
+ comes after it looks like a variable definition. */
wtype = get_next_mword (p2, NULL, &p, &len);
v_origin = o_file;
- if (wtype == w_static && word1eq ("override"))
- {
- v_origin = o_override;
- wtype = get_next_mword (p+len, NULL, &p, &len);
- }
+ exported = 0;
+ if (wtype == w_static)
+ if (word1eq ("override"))
+ {
+ v_origin = o_override;
+ wtype = get_next_mword (p+len, NULL, &p, &len);
+ }
+ else if (word1eq ("export"))
+ {
+ exported = 1;
+ wtype = get_next_mword (p+len, NULL, &p, &len);
+ }
if (wtype != w_eol)
wtype = get_next_mword (p+len, NULL, NULL, NULL);
@@ -1049,7 +1058,8 @@ eval (ebuf, set_default)
variable_buffer_output (p2 + strlen (p2),
semip, strlen (semip)+1);
}
- record_target_var (filenames, p, two_colon, v_origin, fstart);
+ record_target_var (filenames, p, two_colon, v_origin, exported,
+ fstart);
filenames = 0;
continue;
}
@@ -1628,11 +1638,12 @@ uniquize_deps (chain)
variable value list. */
static void
-record_target_var (filenames, defn, two_colon, origin, flocp)
+record_target_var (filenames, defn, two_colon, origin, exported, flocp)
struct nameseq *filenames;
char *defn;
int two_colon;
enum variable_origin origin;
+ int exported;
const struct floc *flocp;
{
struct nameseq *nextf;
@@ -1691,6 +1702,8 @@ record_target_var (filenames, defn, two_colon, origin, flocp)
if (!v)
error (flocp, _("Malformed per-target variable definition"));
v->per_target = 1;
+ if (exported)
+ v->export = v_export;
/* If it's not an override, check to see if there was a command-line
setting. If so, reset the value. */