NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: toolchain/50731: config(8) adds bogus directories to include path



The following reply was made to PR toolchain/50731; it has been noted by GNATS.

From: Rin Okuyama <okuyama%flex.phys.tohoku.ac.jp@localhost>
To: gnats-bugs%NetBSD.org@localhost, uebayasi%gmail.com@localhost
Cc: 
Subject: Re: toolchain/50731: config(8) adds bogus directories to include path
Date: Thu, 4 Feb 2016 22:05:33 +0900

 On 2016/02/04 11:15, Masao Uebayashi wrote:
 >   I was only talking about the long term direction.  I come to think
 >   that the conditional "makeoptions" is one step foward, and I'm OK with
 >   that.
 
 I understand. Here I attached revised patches for the two plans,
 with which GENERIC kernel for amd64 is successfully built.
 
 Plan-1: Leave the current implementation almost untouched; keep the
 variable "allprefixes" and logic related to it. In the final step,
 do not emit include path.
 
 ====
 --- src/usr.bin/config/defs.h.orig	2016-02-04 21:35:58.527160744 +0900
 +++ src/usr.bin/config/defs.h	2016-02-04 21:29:14.023277339 +0900
 @@ -492,9 +492,11 @@
  struct filelist		allofiles;	/* list of all .o files */
  
  struct prefixlist	prefixes,	/* prefix stack */
 -			allprefixes;	/* all prefixes used (after popped) */
 +			allprefixes;	/* all prefixes used (after popped,
 +					   not currently used) */
  struct prefixlist	buildprefixes,	/* build prefix stack */
 -			allbuildprefixes;/* all build prefixes used (after popped) */
 +			allbuildprefixes;/* all build prefixes used (after
 +					    popped, not currently used) */
  SLIST_HEAD(, prefix)	curdirs;	/* curdir stack */
  
  extern struct attr allattr;
 --- src/usr.bin/config/mkmakefile.c.orig	2016-02-04 21:35:51.631754007 +0900
 +++ src/usr.bin/config/mkmakefile.c	2016-02-04 21:32:55.517993638 +0900
 @@ -558,6 +558,7 @@
  static void
  emitincludes(FILE *fp)
  {
 +#if 0
  	struct prefix *pf;
  
  	SLIST_FOREACH(pf, &allprefixes, pf_next) {
 @@ -566,6 +567,9 @@
  		fprintf(fp, "EXTRA_INCLUDES+=\t-I%s%s\n",
  		    prologue, pf->pf_prefix);
  	}
 +#else
 +	/* nothing; see toolchain/50731 */
 +#endif
  }
  
  /*
 ====
 
 Plan-2: Leave the previous patch almost untouched; remove "allprefixes"
 and related logic. Only keep "%INCLUDES" as a reserved word.
 
 ====
 --- src/usr.bin/config/defs.h.orig	2016-02-04 21:18:10.087159194 +0900
 +++ src/usr.bin/config/defs.h	2016-02-04 21:21:28.212663989 +0900
 @@ -491,10 +491,8 @@
  struct filelist		allsfiles;	/* list of all .S files */
  struct filelist		allofiles;	/* list of all .o files */
  
 -struct prefixlist	prefixes,	/* prefix stack */
 -			allprefixes;	/* all prefixes used (after popped) */
 -struct prefixlist	buildprefixes,	/* build prefix stack */
 -			allbuildprefixes;/* all build prefixes used (after popped) */
 +struct prefixlist	prefixes;	/* prefix stack */
 +struct prefixlist	buildprefixes;	/* build prefix stack */
  SLIST_HEAD(, prefix)	curdirs;	/* curdir stack */
  
  extern struct attr allattr;
 --- src/usr.bin/config/mkmakefile.c.orig	2016-02-04 21:18:10.087790344 +0900
 +++ src/usr.bin/config/mkmakefile.c	2016-02-04 21:23:24.101189349 +0900
 @@ -75,7 +75,6 @@
  static void emitsfiles(FILE *);
  static void emitrules(FILE *);
  static void emitload(FILE *);
 -static void emitincludes(FILE *);
  static void emitappmkoptions(FILE *);
  static void emitsubs(FILE *, const char *, const char *, int);
  static int  selectopt(const char *, void *);
 @@ -155,7 +154,7 @@
  		else if (strcmp(line, "%LOAD\n") == 0)
  			fn = emitload;
  		else if (strcmp(line, "%INCLUDES\n") == 0)
 -			fn = emitincludes;
 +			fn = NULL; /* reserved */
  		else if (strcmp(line, "%MAKEOPTIONSAPPEND\n") == 0)
  			fn = emitappmkoptions;
  		else if (strncmp(line, "%VERSION ", sizeof("%VERSION ")-1) == 0) {
 @@ -174,7 +173,8 @@
  				emitsubs(ofp, line, ifname, lineno);
  			continue;
  		}
 -		(*fn)(ofp);
 +		if (fn != NULL)
 +			(*fn)(ofp);
  	}
  
  	fflush(ofp);
 @@ -553,22 +553,6 @@
  }
  
  /*
 - * Emit include headers (for any prefixes encountered)
 - */
 -static void
 -emitincludes(FILE *fp)
 -{
 -	struct prefix *pf;
 -
 -	SLIST_FOREACH(pf, &allprefixes, pf_next) {
 -		const char *prologue = (*pf->pf_prefix == '/') ? "" : "$S/";
 -
 -		fprintf(fp, "EXTRA_INCLUDES+=\t-I%s%s\n",
 -		    prologue, pf->pf_prefix);
 -	}
 -}
 -
 -/*
   * Emit appending makeoptions.
   */
  static void
 --- src/usr.bin/config/util.c.orig	2016-02-04 21:18:10.088225263 +0900
 +++ src/usr.bin/config/util.c	2016-02-04 21:21:28.213424120 +0900
 @@ -95,7 +95,7 @@
  }
  
  static void
 -prefixlist_pop(struct prefixlist *allpl, struct prefixlist *pl)
 +prefixlist_pop(struct prefixlist *pl)
  {
  	struct prefix *pf;
  
 @@ -105,8 +105,6 @@
  	}
  
  	SLIST_REMOVE_HEAD(pl, pf_next);
 -	/* Remember this prefix for emitting -I... directives later. */
 -	SLIST_INSERT_HEAD(allpl, pf, pf_next);
  }
  
  /*
 @@ -124,7 +122,7 @@
  void
  prefix_pop(void)
  {
 -	prefixlist_pop(&allprefixes, &prefixes);
 +	prefixlist_pop(&prefixes);
  }
  
  /*
 @@ -142,7 +140,7 @@
  void
  buildprefix_pop(void)
  {
 -	prefixlist_pop(&allbuildprefixes, &buildprefixes);
 +	prefixlist_pop(&buildprefixes);
  }
  
  /*
 ====
 


Home | Main Index | Thread Index | Old Index