From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id 35CE83857700; Mon, 10 Jul 2023 19:09:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 35CE83857700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1689016171; bh=dfOy4hYv5kr9UgklDTELfHjRgs7p5XTWqVuP51eMTAo=; h=From:To:Subject:Date:From; b=mnnY1n5n8MDQnPMqHCzS/INI4pbBRJZwRg7fH4vyToiZaTe9uk583DmzIdUFwLze5 +Zqu+J1GFHooaZv+4Z2URlUx9ddbwFRQy2USYQtru4zPk28SMZN9jOPQQtVnj3VtNm l36xy/GXEQBz0tcbge/Pg4gtjwqeuY4dNUf3uLSo= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Adhemerval Zanella To: glibc-cvs@sourceware.org Subject: [glibc/azanella/check-headers] scripts: Add fortify checks on installed headers X-Act-Checkin: glibc X-Git-Author: Adhemerval Zanella X-Git-Refname: refs/heads/azanella/check-headers X-Git-Oldrev: 3dd2a57ab095f478eea1c99c0e4c584471db71ce X-Git-Newrev: 035ca6b5365cc4772f3f08fe7d9639f5c7fc254c Message-Id: <20230710190931.35CE83857700@sourceware.org> Date: Mon, 10 Jul 2023 19:09:31 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=035ca6b5365cc4772f3f08fe7d9639f5c7fc254c commit 035ca6b5365cc4772f3f08fe7d9639f5c7fc254c Author: Adhemerval Zanella Date: Tue Jun 20 16:55:10 2023 -0300 scripts: Add fortify checks on installed headers The _FORTIFY_SOURCE is used as default by some system compilers, and there is no way to check if some fortify extension does not trigger any conformance issue. Checked on x86_64-linux-gnu. Reviewed-by: Carlos O'Donell Diff: --- scripts/check-installed-headers.sh | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/scripts/check-installed-headers.sh b/scripts/check-installed-headers.sh index 5a50a491ca..23506a2514 100644 --- a/scripts/check-installed-headers.sh +++ b/scripts/check-installed-headers.sh @@ -29,6 +29,9 @@ cxx_modes="-std=c++98 -std=gnu++98 -std=c++11 -std=gnu++11" # These are probably the most commonly used three. lib_modes="-D_DEFAULT_SOURCE=1 -D_GNU_SOURCE=1 -D_XOPEN_SOURCE=700" +# Also check for fortify modes, since it might be enabled as default. +fortify_modes="1 2 3" + if [ $# -lt 3 ]; then echo "usage: $0 c|c++ \"compile command\" header header header..." >&2 exit 2 @@ -100,29 +103,36 @@ EOF echo :: "$header" for lang_mode in "" $lang_modes; do for lib_mode in "" $lib_modes; do - echo :::: $lang_mode $lib_mode - if [ -z "$lib_mode" ]; then - expanded_lib_mode='/* default library mode */' - else - expanded_lib_mode=$(echo : $lib_mode | \ - sed 's/^: -D/#define /; s/=/ /') - fi - cat >"$cih_test_c" <"$cih_test_c" < int avoid_empty_translation_unit; EOF - if $cc_cmd -finput-charset=ascii -fsyntax-only $lang_mode \ - "$cih_test_c" 2>&1 - then : - else failed=1 - fi + if $cc_cmd -finput-charset=ascii -fsyntax-only $lang_mode \ + "$cih_test_c" 2>&1 + then : + else failed=1 + fi + done done done done