On 06/18/2012 09:40 AM, Vincent Torri wrote:
But you can still be shorter than using a pushdef:
option=m4_bpatsubst([[$2]], [^-Wno-], [-W])
does not work. Removing ^ seems to work
Oh, right. That's due to the necessity of double-quoting $2 introducing
extra characters to be matched by the regex. Omitting the anchor means
that you will match -Wno- wherever it appears (even in
-fsome-Wno-option); and if you are worried about that being a real
possibility, then you can restore the anchoring effect by taking into
account the double-qouting, and all without unbalancing [], by the use
of the . regex:
option=m4_bpatsubst([[$2]], [^\(.\)-Wno-], [\1-W])
But you are probably right that you don't have to worry about -Wno-
appearing anywhere but the beginning, in which case omitting the anchor
is indeed simplest.