Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 Feb 2020 23:36:57 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r358265 - head/usr.sbin/config
Message-ID:  <202002232336.01NNavfI009258@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Sun Feb 23 23:36:56 2020
New Revision: 358265
URL: https://svnweb.freebsd.org/changeset/base/358265

Log:
  Relax machine directives a little.
  
  Currently, you can have multiple machine directives if they are otherwise
  identical. Relax this so that only the machinename part is the same. This allows
  one to change the machine arch in a different config file you've included easily.

Modified:
  head/usr.sbin/config/config.5
  head/usr.sbin/config/config.y

Modified: head/usr.sbin/config/config.5
==============================================================================
--- head/usr.sbin/config/config.5	Sun Feb 23 23:29:53 2020	(r358264)
+++ head/usr.sbin/config/config.5	Sun Feb 23 23:36:56 2020	(r358265)
@@ -283,7 +283,8 @@ corresponds to MACHINE_ARCH.
 .Pp
 A kernel configuration file may have only one
 .Ic machine
-directive.
+directive, unless the second one matches the
+machine argument in the first one exactly.
 .\" -------- MAKEOPTION --------
 .Pp
 .It Ic makeoption Ar options

Modified: head/usr.sbin/config/config.y
==============================================================================
--- head/usr.sbin/config/config.y	Sun Feb 23 23:29:53 2020	(r358264)
+++ head/usr.sbin/config/config.y	Sun Feb 23 23:36:56 2020	(r358265)
@@ -155,8 +155,11 @@ Config_spec:
 		machinearch = $2;
 	      } |
 	ARCH Save_id Save_id {
-		if (machinename != NULL &&
-		    !(eq($2, machinename) && eq($3, machinearch)))
+		/*
+		 * Allow the machinearch to change with a second machine directive,
+		 * but still enforce no changes to the machinename.
+		 */
+		if (machinename != NULL && !eq($2, machinename))
 		    errx(1, "%s:%d: only one machine directive is allowed",
 			yyfile, yyline);
 		machinename = $2;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202002232336.01NNavfI009258>