NetBSD-Bugs archive

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

Re: toolchain/46750 (make oddity expanding variables assigned to with +=)



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

From: Robert Elz <kre%munnari.OZ.AU@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: toolchain/46750 (make oddity expanding variables assigned to with +=)
Date: Thu, 07 Apr 2022 19:30:56 +0700

     Date:        Wed,  6 Apr 2022 23:21:51 +0000 (UTC)
     From:        dholland=40NetBSD.org
     Message-ID:  <20220406232151.63B331A923B=40mollari.NetBSD.org>
 
   =7C 2. Fix append so that if either side of the append is empty it just=
  copies
   =7C the other string instead of also inserting a space.
   =7C
   =7C Inertia favors =231. I kind of prefer =232
 
 FWIW, what POSIX says (or perhaps will say, there are lots of changes
 in this area, and I'm not really keeping track of what is current, and
 what is new).
 
 	The following form (the append form) appends additional text
 	to the value of a macro:
 
 		string1 +=3D =5Bstring2=5D
 
 	When using the append form:
 
 	    =B7 If the macro named by string1 does not exist, this form shall
 	      be equivalent to the delayed-expansion form
 
        		string1 =3D =5Bstring2=5D
 
 That would be your =232 (or part of it).
 
 	    =B7 If the macro named by string1 exists and is an
   	      immediate-expansion macro, then a <space> or <tab> character
 	      followed by the evaluation of string2 shall be appended to
 	      the value currently assigned to the macro named by string1.
 
 	    =B7 If the macro named by string1 exists and is a delayed-expansion
 	      macro, then a <space> or <tab> character followed by the
 	      unevaluated string2 shall be appended to the value currently
 	      assigned to the macro named by string1.
 
 Nothing in those about =22unless nothing would be appended=22 where the <=
 space>
 (or tab) is inserted, so this case would be your =231.
 
 Not sure whether there's a distinction (wrt string1) between =22doesn't e=
 xist=22
 and =22exists with an empty value=22.
 
 Kind of unrelated to this point, but it also says:
 
 	The value of string2 is defined as all characters from the first
 	non-<blank> character, if any, after the <equals-sign>, up to but
 	not including a comment character ('=23') or an unescaped <newline>.
 
 which implies that trailing white space (any amount) is included.
 
 kre
 


Home | Main Index | Thread Index | Old Index