From nobody Thu Sep 07 20:28:55 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RhW6b312Fz4st4T; Thu, 7 Sep 2023 20:28:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RhW6b2CBYz4b0n; Thu, 7 Sep 2023 20:28:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694118535; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VwCZojnHNTnYqu0GDLasdj9j/v9wb9I0Nj/DojXxG2E=; b=MEV9RUhJKSYZ968YrxJ2pDBhoQpumUIPgFNxDpyoF8aToz/EjB0AUaN+QB+nGJGgKodGVY uYTdusppWYXtpFf9xtwhoyhThTxe9aP3dlRV+5ZByxlBPGhXCDTLf+eoUWo1GCI4ycMDYl 3O+N6id0YGm7vzruRS2lh0ms1tgIuiuJV7l9XZLR7VwO492WzB4r80M3HhE6WfyClpafuq WYng6FYhK5vzv9j4rYqMR1kGL+7WOihzgGaNSTXe1B91d/j18J1EbF94HDsHOUzi1fk9oE E3tj4yxi7if0qLE4sqSvobRQAYy/yqpSqcddZZckbGdB2mXpDXuJeFJ0J8geVA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1694118535; a=rsa-sha256; cv=none; b=RXtMNd62ZQ6gp4i/ixoKAK1AocB1ZXZQOHZdSKjPZXk7awkSUyyVp/p0T3HYxKHa9PSf6/ SdZhF6RIQxgFj3N1PW5JQb6e2tJUKn5lxcsQobNUWodX8LHa2YN3Z2QxDMkegY4HhWV3n7 Er8N8milmXktWgMyPbzjB4FNkpuQOA2G/2VnIq3eYf8672p1LFpZeKRvMhetX+4yI3ZrTU T3GjrVmxN0ntGFQA2JVnsfEEMT1IuHjMSPPlj72ogxR37OsKnPRsi19a1GU33Warn4tKJn OLz43dlbkbJbEtz/5F8/zraqeNYMav4bhurwrJzyL+Rj2fvRWoNqq2UjygQJvw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694118535; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VwCZojnHNTnYqu0GDLasdj9j/v9wb9I0Nj/DojXxG2E=; b=i7GeJA/LgCM0rj4uRMPUVLSLatt+YCr/+8wVQk8otySBSMr7Xwm3HnbHN78xciJsOoNA3m 6zKBSVT1MG7lbELBpAA8z2rm6AvkWu57DLezHamVF48bnSCn7LVmcNIYw6TgWJyzwKgLRa UBj4d6cKNKRXwffkKHzc0A2uVA4nwHtPhEG1sKrcRR9XKPwTeq9dmM1N0PCg7pbpIl1L6a HZ2jTr6HtQcZDQXz8KNGmY6lRxLRFOKgBjp1wajBiHqbdXWSiJpqW3tBdMgHuGPG6nFHqU UZfxUMhjdyZPmg9yA61IxVn+y6zfNu5HVUYNi5TrvRFvZyXe6sfrXXSNiKaFmw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4RhW6b19b4z1CN4; Thu, 7 Sep 2023 20:28:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 387KStlK064987; Thu, 7 Sep 2023 20:28:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 387KStDh064984; Thu, 7 Sep 2023 20:28:55 GMT (envelope-from git) Date: Thu, 7 Sep 2023 20:28:55 GMT Message-Id: <202309072028.387KStDh064984@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: 0171f9ccfed8 - stable/14 - unifdef: Handle redefined symbols correctly. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 0171f9ccfed8400a42a6cc44dc7bb0211a955603 Auto-Submitted: auto-generated The branch stable/14 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=0171f9ccfed8400a42a6cc44dc7bb0211a955603 commit 0171f9ccfed8400a42a6cc44dc7bb0211a955603 Author: Dag-Erling Smørgrav AuthorDate: 2023-09-06 17:11:04 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2023-09-07 20:28:31 +0000 unifdef: Handle redefined symbols correctly. MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D41758 (cherry picked from commit aacbe7384221d2eafa326864bbbe2f22a10063ce) Approved by: re (gjb) --- contrib/unifdef/unifdef.c | 6 +++++- usr.bin/unifdef/tests/unifdef_test.sh | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/contrib/unifdef/unifdef.c b/contrib/unifdef/unifdef.c index 82f6acd66038..3dd4ace7b81e 100644 --- a/contrib/unifdef/unifdef.c +++ b/contrib/unifdef/unifdef.c @@ -1550,8 +1550,12 @@ addsym2(bool ignorethis, const char *symname, const char *val) sym->value = val; r = RB_INSERT(MACROMAP, ¯o_tree, sym); assert(r == NULL); + debugsym("addsym", sym); + } else { + sym->ignore = ignorethis; + sym->value = val; + debugsym("updsym", sym); } - debugsym("addsym", sym); } static void diff --git a/usr.bin/unifdef/tests/unifdef_test.sh b/usr.bin/unifdef/tests/unifdef_test.sh index 98adef3adfdc..dfb08c187724 100644 --- a/usr.bin/unifdef/tests/unifdef_test.sh +++ b/usr.bin/unifdef/tests/unifdef_test.sh @@ -17,6 +17,27 @@ EOF atf_check -o file:f unifdef file <