public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] contrib: Fill in HOST{CC,CFLAGS,CXX,CXXFLAGS} in test_installed
@ 2024-02-05 13:50 Jakub Jelinek
  2024-02-05 16:07 ` Jeff Law
  2024-02-06  5:12 ` Alexandre Oliva
  0 siblings, 2 replies; 3+ messages in thread
From: Jakub Jelinek @ 2024-02-05 13:50 UTC (permalink / raw)
  To: Alexandre Oliva, Rainer Orth, Mike Stump; +Cc: gcc-patches

Hi!

gcc/Makefile.in since my r0-60234 change fills in HOSTCC and HOSTCFLAGS
in site.exp and since r8-671 also HOSTCXX and HOSTCXXFLAGS.
If those variables aren't set, we get errors like:
/usr/src/gcc/contrib/test_installed --without-g++ --without-gfortran --without-objc struct-layout-1.exp
...
ERROR: tcl error sourcing /usr/src/gcc/gcc/testsuite/gcc.dg/compat/struct-layout-1.exp.
ERROR: tcl error code TCL LOOKUP VARNAME HOSTCC
ERROR: can't read "HOSTCC": no such variable
    while executing
"remote_exec build "$HOSTCC $HOSTCFLAGS $generator_cmd""
    (file "/usr/src/gcc/gcc/testsuite/gcc.dg/compat/struct-layout-1.exp" line 96)
    invoked from within
"source /usr/src/gcc/gcc/testsuite/gcc.dg/compat/struct-layout-1.exp"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 source /usr/src/gcc/gcc/testsuite/gcc.dg/compat/struct-layout-1.exp"
    invoked from within
"catch "uplevel #0 source $test_file_name" msg"

(similarly in g++ or gfortran) struct-layout-1.exp.  One doesn't need to
test specially for just struct-layout-1.exp alone, just not using any arg
will trigger it as well, just later.

The following patch fills it in as cc and c++ with empty flags to compile
those, I believe that is what e.g. make uses by default, so it should be a
reasonable default.  We IMHO shouldn't default to GCC_UNDER_TEST because
that might be a cross-compiler etc.

Ok for trunk?

2024-02-05  Jakub Jelinek  <jakub@redhat.com>

	* test_installed: Fill in HOSTCC, HOSTCXX, HOSTCFLAGS and
	HOSTCXXFLAGS.

--- contrib/test_installed.jj	2024-01-03 11:51:20.865879222 +0100
+++ contrib/test_installed	2024-02-05 14:36:03.625047250 +0100
@@ -114,6 +114,10 @@ set GCC_UNDER_TEST "${GCC_UNDER_TEST-${p
 set GXX_UNDER_TEST "${GXX_UNDER_TEST-${prefix}${prefix+/bin/}g++}"
 set GFORTRAN_UNDER_TEST "${GFORTRAN_UNDER_TEST-${prefix}${prefix+/bin/}gfortran}"
 set OBJC_UNDER_TEST "${OBJC_UNDER_TEST-${prefix}${prefix+/bin/}gcc}"
+set HOSTCC "${HOSTCC-cc}"
+set HOSTCXX "${HOSTCXX-c++}"
+set HOSTCFLAGS ""
+set HOSTCXXFLAGS ""
 EOF
 if test x${target} != x; then
   echo "set target_triplet $target" >> site.exp

	Jakub


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] contrib: Fill in HOST{CC,CFLAGS,CXX,CXXFLAGS} in test_installed
  2024-02-05 13:50 [PATCH] contrib: Fill in HOST{CC,CFLAGS,CXX,CXXFLAGS} in test_installed Jakub Jelinek
@ 2024-02-05 16:07 ` Jeff Law
  2024-02-06  5:12 ` Alexandre Oliva
  1 sibling, 0 replies; 3+ messages in thread
From: Jeff Law @ 2024-02-05 16:07 UTC (permalink / raw)
  To: Jakub Jelinek, Alexandre Oliva, Rainer Orth, Mike Stump; +Cc: gcc-patches



On 2/5/24 06:50, Jakub Jelinek wrote:
> Hi!
> 
> gcc/Makefile.in since my r0-60234 change fills in HOSTCC and HOSTCFLAGS
> in site.exp and since r8-671 also HOSTCXX and HOSTCXXFLAGS.
> If those variables aren't set, we get errors like:
> /usr/src/gcc/contrib/test_installed --without-g++ --without-gfortran --without-objc struct-layout-1.exp
> ...
> ERROR: tcl error sourcing /usr/src/gcc/gcc/testsuite/gcc.dg/compat/struct-layout-1.exp.
> ERROR: tcl error code TCL LOOKUP VARNAME HOSTCC
> ERROR: can't read "HOSTCC": no such variable
>      while executing
> "remote_exec build "$HOSTCC $HOSTCFLAGS $generator_cmd""
>      (file "/usr/src/gcc/gcc/testsuite/gcc.dg/compat/struct-layout-1.exp" line 96)
>      invoked from within
> "source /usr/src/gcc/gcc/testsuite/gcc.dg/compat/struct-layout-1.exp"
>      ("uplevel" body line 1)
>      invoked from within
> "uplevel #0 source /usr/src/gcc/gcc/testsuite/gcc.dg/compat/struct-layout-1.exp"
>      invoked from within
> "catch "uplevel #0 source $test_file_name" msg"
> 
> (similarly in g++ or gfortran) struct-layout-1.exp.  One doesn't need to
> test specially for just struct-layout-1.exp alone, just not using any arg
> will trigger it as well, just later.
> 
> The following patch fills it in as cc and c++ with empty flags to compile
> those, I believe that is what e.g. make uses by default, so it should be a
> reasonable default.  We IMHO shouldn't default to GCC_UNDER_TEST because
> that might be a cross-compiler etc.
> 
> Ok for trunk?
> 
> 2024-02-05  Jakub Jelinek  <jakub@redhat.com>
> 
> 	* test_installed: Fill in HOSTCC, HOSTCXX, HOSTCFLAGS and
> 	HOSTCXXFLAGS.
Ugh.  test_installed :(  Probably a necessary evil, though I suspect few 
people are using it.  So if it works for the scenarios you're testing, 
then OK by me.


jeff

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] contrib: Fill in HOST{CC,CFLAGS,CXX,CXXFLAGS} in test_installed
  2024-02-05 13:50 [PATCH] contrib: Fill in HOST{CC,CFLAGS,CXX,CXXFLAGS} in test_installed Jakub Jelinek
  2024-02-05 16:07 ` Jeff Law
@ 2024-02-06  5:12 ` Alexandre Oliva
  1 sibling, 0 replies; 3+ messages in thread
From: Alexandre Oliva @ 2024-02-06  5:12 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Rainer Orth, Mike Stump, gcc-patches

On Feb  5, 2024, Jakub Jelinek <jakub@redhat.com> wrote:

> 	* test_installed: Fill in HOSTCC, HOSTCXX, HOSTCFLAGS and
> 	HOSTCXXFLAGS.

LGTM, thanks,

-- 
Alexandre Oliva, happy hacker                    https://FSFLA.org/blogs/lxo/
   Free Software Activist                           GNU Toolchain Engineer
Disinformation flourishes because many people care deeply about injustice but
very few check the facts.  Think Assange & Stallman.  The empires strike back

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-02-06  5:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-05 13:50 [PATCH] contrib: Fill in HOST{CC,CFLAGS,CXX,CXXFLAGS} in test_installed Jakub Jelinek
2024-02-05 16:07 ` Jeff Law
2024-02-06  5:12 ` Alexandre Oliva

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).