From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2063) id 740D73856947; Tue, 13 Sep 2022 05:21:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 740D73856947 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1663046495; bh=KV+MjCr8oLsKE2qOKD1FFA+G7VeIzn4AXbsX6GREBO4=; h=From:To:Subject:Date:From; b=J6MstYFYUBz/SOoeITe6H5kHmuLfgUrFnt3QyJO9fqAG9/VfY2ipe+PJvlP2CmgR3 jhb6QYPqd6l2nUrbkSJmidTuUsoZzOyAum1Zn/jZa/2XB0jrXEc+d7o1ROKHCv6/Gm qjrC0Y6X/0Emnf0XIHk7+WjCPptiGlRAWR41tiNU= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Kewen Lin To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-8761] rs6000/test: Fix empty TU in some cases of effective targets [PR106345] X-Act-Checkin: gcc X-Git-Author: Kewen Lin X-Git-Refname: refs/heads/releases/gcc-12 X-Git-Oldrev: 99c0c61618186c3cc4c3ada802dd18cf76558706 X-Git-Newrev: 19e217a2b9d08508203b6e645b67ab63b17af5f8 Message-Id: <20220913052135.740D73856947@sourceware.org> Date: Tue, 13 Sep 2022 05:21:35 +0000 (GMT) List-Id: https://gcc.gnu.org/g:19e217a2b9d08508203b6e645b67ab63b17af5f8 commit r12-8761-g19e217a2b9d08508203b6e645b67ab63b17af5f8 Author: Kewen Lin Date: Tue Sep 6 20:37:57 2022 -0500 rs6000/test: Fix empty TU in some cases of effective targets [PR106345] As the failure of test case gcc.target/powerpc/pr92398.p9-.c in PR106345 shows, some test sources for some powerpc effective targets use empty translation unit wrongly. The test sources could go with options like "-ansi -pedantic-errors", then those effective target checkings will fail unexpectedly with the error messages like: error: ISO C forbids an empty translation unit [-Wpedantic] This patch is to fix empty TUs with one dummy function definition accordingly. PR testsuite/106345 gcc/testsuite/ChangeLog: * lib/target-supports.exp (check_effective_target_powerpc_sqrt): Add a function definition to avoid pedwarn about empty translation unit. (check_effective_target_has_arch_pwr5): Likewise. (check_effective_target_has_arch_pwr6): Likewise. (check_effective_target_has_arch_pwr7): Likewise. (check_effective_target_has_arch_pwr8): Likewise. (check_effective_target_has_arch_pwr9): Likewise. (check_effective_target_has_arch_pwr10): Likewise. (check_effective_target_has_arch_ppc64): Likewise. (check_effective_target_ppc_float128): Likewise. (check_effective_target_ppc_float128_insns): Likewise. (check_effective_target_powerpc_vsx): Likewise. (cherry picked from commit 7a43e52a48b6403a99d3e8ab3105869b4b3c081e) Diff: --- gcc/testsuite/lib/target-supports.exp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 244fe2306f4..3a4f65b9be6 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -6240,9 +6240,12 @@ proc check_effective_target_powerpc_sqrt { } { } return [check_no_compiler_messages powerpc_sqrt object { + void test (void) + { #ifndef _ARCH_PPCSQ #error _ARCH_PPCSQ is not defined #endif + } } {}] } @@ -6350,71 +6353,92 @@ proc check_effective_target_powerpc_p9modulo_ok { } { # as provided by the test. proc check_effective_target_has_arch_pwr5 { } { return [check_no_compiler_messages_nocache arch_pwr5 assembly { + void test (void) + { #ifndef _ARCH_PWR5 #error does not have power5 support. #else /* "has power5 support" */ #endif + } } [current_compiler_flags]] } proc check_effective_target_has_arch_pwr6 { } { return [check_no_compiler_messages_nocache arch_pwr6 assembly { + void test (void) + { #ifndef _ARCH_PWR6 #error does not have power6 support. #else /* "has power6 support" */ #endif + } } [current_compiler_flags]] } proc check_effective_target_has_arch_pwr7 { } { return [check_no_compiler_messages_nocache arch_pwr7 assembly { + void test (void) + { #ifndef _ARCH_PWR7 #error does not have power7 support. #else /* "has power7 support" */ #endif + } } [current_compiler_flags]] } proc check_effective_target_has_arch_pwr8 { } { return [check_no_compiler_messages_nocache arch_pwr8 assembly { + void test (void) + { #ifndef _ARCH_PWR8 #error does not have power8 support. #else /* "has power8 support" */ #endif + } } [current_compiler_flags]] } proc check_effective_target_has_arch_pwr9 { } { return [check_no_compiler_messages_nocache arch_pwr9 assembly { + void test (void) + { #ifndef _ARCH_PWR9 #error does not have power9 support. #else /* "has power9 support" */ #endif + } } [current_compiler_flags]] } proc check_effective_target_has_arch_pwr10 { } { return [check_no_compiler_messages_nocache arch_pwr10 assembly { + void test (void) + { #ifndef _ARCH_PWR10 #error does not have power10 support. #else /* "has power10 support" */ #endif + } } [current_compiler_flags]] } proc check_effective_target_has_arch_ppc64 { } { return [check_no_compiler_messages_nocache arch_ppc64 assembly { + void test (void) + { #ifndef _ARCH_PPC64 #error does not have ppc64 support. #else /* "has ppc64 support" */ #endif + } } [current_compiler_flags]] } @@ -6501,9 +6525,12 @@ proc check_effective_target_powerpc_float128_hw_ok { } { proc check_effective_target_ppc_float128 { } { return [check_no_compiler_messages_nocache ppc_float128 object { + void test (void) + { #ifndef __FLOAT128__ nope no good #endif + } }] } @@ -6511,9 +6538,12 @@ proc check_effective_target_ppc_float128 { } { proc check_effective_target_ppc_float128_insns { } { return [check_no_compiler_messages_nocache ppc_float128 object { + void test (void) + { #ifndef __FLOAT128_HARDWARE__ nope no good #endif + } }] } @@ -6521,9 +6551,12 @@ proc check_effective_target_ppc_float128_insns { } { proc check_effective_target_powerpc_vsx { } { return [check_no_compiler_messages_nocache powerpc_vsx object { + void test (void) + { #ifndef __VSX__ nope no vsx #endif + } }] }