Patchwork [1/3] Update create-version.sh to use common/version.h

login
register
mail settings
Submitter Tom Tromey
Date Jan. 23, 2019, 5:29 p.m.
Message ID <20190123172954.24421-2-tom@tromey.com>
Download mbox | patch
Permalink /patch/31196/
State New
Headers show

Comments

Tom Tromey - Jan. 23, 2019, 5:29 p.m.
This changes create-version.sh to have the generated file use
common/version.h as the file name.

2019-01-23  Tom Tromey  <tom@tromey.com>

	* common/create-version.sh: Use common/version.h.
---
 gdb/ChangeLog                | 4 ++++
 gdb/common/create-version.sh | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)
Simon Marchi - Jan. 26, 2019, 1 a.m.
On 2019-01-23 12:29, Tom Tromey wrote:
> This changes create-version.sh to have the generated file use
> common/version.h as the file name.
> 
> 2019-01-23  Tom Tromey  <tom@tromey.com>
> 
> 	* common/create-version.sh: Use common/version.h.
> ---
>  gdb/ChangeLog                | 4 ++++
>  gdb/common/create-version.sh | 2 +-
>  2 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/gdb/common/create-version.sh 
> b/gdb/common/create-version.sh
> index 51cffe8db5..6e67a61357 100755
> --- a/gdb/common/create-version.sh
> +++ b/gdb/common/create-version.sh
> @@ -30,7 +30,7 @@ output="$4"
>  rm -f version.c-tmp $output version.tmp
>  date=`sed -n -e 's/^.* BFD_VERSION_DATE \(.*\)$/\1/p' 
> $srcdir/../bfd/version.h`
>  sed -e "s/DATE/$date/" < $srcdir/version.in > version.tmp
> -echo '#include "version.h"' >> version.c-tmp
> +echo '#include "common/version.h"' >> version.c-tmp
>  echo 'const char version[] = "'"`sed q version.tmp`"'";' >> 
> version.c-tmp
>  echo 'const char host_name[] = "'"$host_alias"'";' >> version.c-tmp
>  echo 'const char target_name[] = "'"$target_alias"'";' >> 
> version.c-tmp

Hi Tom,

Somebody reported this compilation error when building the simulator 
with an aarch64 target (sorry about the formatting, I'm on web client):

ccache /opt/gcc/8.2/bin/gcc -DHAVE_CONFIG_H  
-DWITH_DEFAULT_ALIGNMENT=NONSTRICT_ALIGNMENT     -DDEFAULT_INLINE=0   
-Wall -Wdeclaration-after-statement -Wpointer-arith -Wpointer-sign 
-Wno-unused -Wunused-value -Wunused-function -Wno-switch 
-Wno-char-subscripts -Wmissing-prototypes -Wdeclaration-after-statement 
-Wempty-body -Wmissing-parameter-type -Wold-style-declaration 
-Wold-style-definition -Wformat-nonliteral      -I. 
-I../../../binutils-gdb/sim/aarch64 -I../common 
-I../../../binutils-gdb/sim/aarch64/../common -I../../include 
-I../../../binutils-gdb/sim/aarch64/../../include -I../../bfd 
-I../../../binutils-gdb/sim/aarch64/../../bfd -I../../opcodes 
-I../../../binutils-gdb/sim/aarch64/../../opcodes  -g3 -O0 
-fsanitize=address -c -o version.o -MT version.o -MMD -MP -MF 
.deps/version.Tpo version.c
version.c:1:10: fatal error: common/version.h: No such file or directory
  #include "common/version.h"
           ^~~~~~~~~~~~~~~~~~


You can probably reproduce it with --enable-sim 
--target=aarch64-linux-gnu.

Simon
Tom Tromey - Jan. 26, 2019, 3:58 a.m.
>>>>> "Simon" == Simon Marchi <simon.marchi@polymtl.ca> writes:

Simon> An easy way to fix this would be to add -I$(srcsim) to the include
Simon> paths in sim/common/Make-common.in.  We could actually think of giving
Simon> the same treatment of removing -I../common and -I$(srccom) to sim than
Simon> what you did to GDB.

I don't really know much about the sim, so I don't really have an
opinion on whether that makes sense there.

For the immediate problem, I think it's usually not good to have these
hidden cross-directory dependencies.  This one seems particularly bad
because it's somewhat uncommon to even build the sim.

How about just copying create-version.sh to sim/common and having it use
the old #include "version.h"?  Then the two scripts can evolve in their
own ways as needed, without worrying.

Tom

Patch

diff --git a/gdb/common/create-version.sh b/gdb/common/create-version.sh
index 51cffe8db5..6e67a61357 100755
--- a/gdb/common/create-version.sh
+++ b/gdb/common/create-version.sh
@@ -30,7 +30,7 @@  output="$4"
 rm -f version.c-tmp $output version.tmp
 date=`sed -n -e 's/^.* BFD_VERSION_DATE \(.*\)$/\1/p' $srcdir/../bfd/version.h`
 sed -e "s/DATE/$date/" < $srcdir/version.in > version.tmp
-echo '#include "version.h"' >> version.c-tmp
+echo '#include "common/version.h"' >> version.c-tmp
 echo 'const char version[] = "'"`sed q version.tmp`"'";' >> version.c-tmp
 echo 'const char host_name[] = "'"$host_alias"'";' >> version.c-tmp
 echo 'const char target_name[] = "'"$target_alias"'";' >> version.c-tmp