From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52768) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bvA4K-0000YK-KQ for qemu-devel@nongnu.org; Fri, 14 Oct 2016 17:31:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bvA4H-0004sk-9z for qemu-devel@nongnu.org; Fri, 14 Oct 2016 17:31:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58908) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bvA4G-0004rf-W4 for qemu-devel@nongnu.org; Fri, 14 Oct 2016 17:31:05 -0400 References: <147648037766.14770.15179642645810274907.stgit@bahia> From: Eric Blake Message-ID: Date: Fri, 14 Oct 2016 16:31:01 -0500 MIME-Version: 1.0 In-Reply-To: <147648037766.14770.15179642645810274907.stgit@bahia> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="hHAjD3JeiKpvrqOrMA48bl6ENnvkm3lkq" Subject: Re: [Qemu-devel] [PATCH] trace: fix group name generation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Greg Kurz , qemu-devel@nongnu.org Cc: Stefan Hajnoczi This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --hHAjD3JeiKpvrqOrMA48bl6ENnvkm3lkq From: Eric Blake To: Greg Kurz , qemu-devel@nongnu.org Cc: Stefan Hajnoczi Message-ID: Subject: Re: [Qemu-devel] [PATCH] trace: fix group name generation References: <147648037766.14770.15179642645810274907.stgit@bahia> In-Reply-To: <147648037766.14770.15179642645810274907.stgit@bahia> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 10/14/2016 04:26 PM, Greg Kurz wrote: > Since commit "80dd5c4918ab trace: introduce a formal group name for tra= ce > events", tracetool generates C variable names and macro definitions out= > of the path to the trace-events-all file. >=20 > The current code takes care of turning '/' and '-' characters into > underscores so that the resulting names are valid C tokens. This is > enough because these are the only illegal characters that appear in > a relative path within the QEMU source tree. >=20 > Things are different for out of tree builds where the path may contain > arbitrary character combinations, causing tracetool to generate invalid= > names. >=20 > This patch ensures that only letters [A-Za-z], digits [0-9] and undersc= ores > are kept. All other characters are turned into underscores. Also, since= the > first character of C symbol names cannot be a digit, an underscore is > prepended to the group name. >=20 > Signed-off-by: Greg Kurz > --- > scripts/tracetool.py | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/scripts/tracetool.py b/scripts/tracetool.py > index 629b2593c846..b81b834db924 100755 > --- a/scripts/tracetool.py > +++ b/scripts/tracetool.py > @@ -70,7 +70,7 @@ def make_group_name(filename): > =20 > if dirname =3D=3D "": > return "common" > - return re.sub(r"/|-", "_", dirname) > + return "_" + re.sub(r"[^\w]", "_", dirname) This STILL doesn't solve the complaint that the build is now dependent on the location. Why can't we STRIP off any prefix prior to the in-tree portion of the naming that we know is sane, instead of munging the prefix but in the process creating source code that generates with different lengths? Ideally, compiling twice, once in directory 'a', and the second time in directory 'aaaaaaaaaaaaaaaaaaaaaaaaaaaa', should not make a noticeable difference in the final size of the executable due to the difference in lengths of the debugging symbols used to record the longer name of the second directory being encoded into lots of macro names. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --hHAjD3JeiKpvrqOrMA48bl6ENnvkm3lkq Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJYAU6VAAoJEKeha0olJ0Nq06oH/jHbsLGD4MiLkhepJm4irc1N HvJ3jtRj5cMpzZGRcJu2mCWMfEzii4ZsQp2eLMg/AICfMDx+1DQikWsC2rLL/dVX 2ohLVeUQBr5YjcKt3CJG/Fs+0t63quD1ezfjiJFFA2NDRxh049bK6AiYrEPgHixG FO6GJNqxinbfXtu54NvRLR0a5bcwbMNQ2EzBEnHP6NE2mNjvkBWByrG92EdGE2Ya Bqvns4VLFmLVHOnIoBEyZS/Vnq9Wis2QktNkQNgKsx0npZF8ACqLfaQU39+7kNBy T6QZVNIppbomF2O8hmmm493zbDZcrgLPvV5IWBrFxLWt264+67Dd27V36i8C6uY= =7kt8 -----END PGP SIGNATURE----- --hHAjD3JeiKpvrqOrMA48bl6ENnvkm3lkq--