make-4.2.93 patch port to c90

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

make-4.2.93 patch port to c90

Gnu - Make - Bugs mailing list
Good morning.

This patch replaced a c99 piece of code with c90 code.
This c99 piece of code does not compile with the default ./configure && make.
Also, -std=c99 removes __attribute__.

regards, Dmitry


diff --git a/src/file.c b/src/file.c
index 2f1425e..acc8c0c 100644
--- a/src/file.c
+++ b/src/file.c
@@ -641,8 +641,8 @@ struct dep *
 expand_extra_prereqs (const struct variable *extra)
 {
   struct dep *prereqs = extra ? split_prereqs (variable_expand
(extra->value)) : NULL;
-
-  for (struct dep *d = prereqs; d; d = d->next)
+  struct dep *d = prereqs;
+  for (; d; d = d->next)
     {
       d->file = lookup_file (d->name);
       if (!d->file)
diff --git a/src/rule.c b/src/rule.c
index 358ec56..f2e2ac9 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -72,11 +72,13 @@ snap_implicit_rules (void)
   char *name = NULL;
   size_t namelen = 0;
   struct dep *prereqs = expand_extra_prereqs (lookup_variable
(STRING_SIZE_TUPLE(".EXTRA_PREREQS")));
+  struct dep *d = prereqs;
   unsigned int pre_deps = 0;
+  struct rule *rule = pattern_rules;

   max_pattern_dep_length = 0;

-  for (struct dep *d = prereqs; d; d = d->next)
+  for (; d; d = d->next)
     {
       size_t l = strlen (dep_name (d));
       if (l > max_pattern_dep_length)
@@ -86,17 +88,18 @@ snap_implicit_rules (void)

   num_pattern_rules = max_pattern_targets = max_pattern_deps = 0;

-  for (struct rule *rule = pattern_rules; rule; rule = rule->next)
+  for (; rule; rule = rule->next)
     {
       unsigned int ndeps = pre_deps;
       struct dep *lastdep = NULL;
+      struct dep *dep = rule->deps;

       ++num_pattern_rules;

       if (rule->num > max_pattern_targets)
         max_pattern_targets = rule->num;

-      for (struct dep *dep = rule->deps; dep != 0; dep = dep->next)
+      for (; dep != 0; dep = dep->next)
         {
           const char *dname = dep_name (dep);
           size_t len = strlen (dname);

Reply | Threaded
Open this post in threaded view
|

Re: make-4.2.93 patch port to c90

Paul Smith-20
On Fri, 2020-01-03 at 22:21 -0500, Dmitry Goncharov via Bug reports and
discussion for GNU make wrote:
> This patch replaced a c99 piece of code with c90 code.
> This c99 piece of code does not compile with the default ./configure &&
> make.
> Also, -std=c99 removes __attribute__.

I already made some changes for this; it passes with -std=c90 -pedantic on
my system now (with warnings, at least if you compile with guile, since
guile headers don't support this mode).


Reply | Threaded
Open this post in threaded view
|

Re: make-4.2.93 patch port to c90

Paul Smith-20
On Fri, 2020-01-03 at 23:30 -0500, Paul Smith wrote:

> On Fri, 2020-01-03 at 22:21 -0500, Dmitry Goncharov via Bug reports and
> discussion for GNU make wrote:
> > This patch replaced a c99 piece of code with c90 code.
> > This c99 piece of code does not compile with the default ./configure &&
> > make.
> > Also, -std=c99 removes __attribute__.
>
> I already made some changes for this; it passes with -std=c90 -pedantic
> on my system now (with warnings, at least if you compile with guile,
> since guile headers don't support this mode).

I modified configure.ac to avoid Guile if it doesn't allow GNU make to
compile properly: it seems that the Guile headers require at least C99.