[v2,2/4] Rewrite find_cxx_header config configure.ac
Checks
Context |
Check |
Description |
dj/TryBot-apply_patch |
success
|
Patch applied to master at the time it was sent
|
Commit Message
With clang If the main file is <stdin>, the first non-main-file
dependency is not listed in the -MP output. Although it was fixed
on clang-16 [1], this change adds portability for older version.
[1] https://github.com/llvm/llvm-project/commit/ff9576f74514b836e1ba0268409a2ecb919d7118
---
configure | 4 ++--
configure.ac | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
Comments
On 2022-11-02, Adhemerval Zanella wrote:
>With clang If the main file is <stdin>, the first non-main-file
>dependency is not listed in the -MP output. Although it was fixed
>on clang-16 [1], this change adds portability for older version.
s/If/if/
>[1] https://github.com/llvm/llvm-project/commit/ff9576f74514b836e1ba0268409a2ecb919d7118
>---
> configure | 4 ++--
> configure.ac | 4 ++--
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
>diff --git a/configure b/configure
>index fc3d7842de..e23ea95a49 100755
>--- a/configure
>+++ b/configure
>@@ -5669,8 +5669,8 @@ fi
> # copy of those headers in Makerules.
> if test -n "$CXX"; then
> find_cxx_header () {
>- echo "#include <$1>" | $CXX -M -MP -x c++ - 2>/dev/null \
>- | sed -n "\,$1:,{s/:\$//;p}"
>+ echo "#include <$1>" | $CXX -H -fsyntax-only -x c++ - 2>&1 \
>+ | awk '$1 == "."{print $2}'
> }
> CXX_CSTDLIB_HEADER="$(find_cxx_header cstdlib)"
> CXX_CMATH_HEADER="$(find_cxx_header cmath)"
>diff --git a/configure.ac b/configure.ac
>index 9fc1fb1c1c..7275b53345 100644
>--- a/configure.ac
>+++ b/configure.ac
>@@ -1137,8 +1137,8 @@ AC_SUBST(CXX_SYSINCLUDES)
> # copy of those headers in Makerules.
> if test -n "$CXX"; then
> find_cxx_header () {
>- echo "#include <$1>" | $CXX -M -MP -x c++ - 2>/dev/null \
>- | sed -n "\,$1:,{s/:\$//;p}"
>+ echo "#include <$1>" | $CXX -H -fsyntax-only -x c++ - 2>&1 \
>+ | awk '$1 == "."{print $2}'
> }
> CXX_CSTDLIB_HEADER="$(find_cxx_header cstdlib)"
> CXX_CMATH_HEADER="$(find_cxx_header cmath)"
>--
>2.34.1
>
Thanks.
Reviewed-by: Fangrui Song <maskray@google.com>
* Adhemerval Zanella via Libc-alpha:
> diff --git a/configure b/configure
> index fc3d7842de..e23ea95a49 100755
> --- a/configure
> +++ b/configure
> @@ -5669,8 +5669,8 @@ fi
> # copy of those headers in Makerules.
> if test -n "$CXX"; then
> find_cxx_header () {
> - echo "#include <$1>" | $CXX -M -MP -x c++ - 2>/dev/null \
> - | sed -n "\,$1:,{s/:\$//;p}"
> + echo "#include <$1>" | $CXX -H -fsyntax-only -x c++ - 2>&1 \
> + | awk '$1 == "."{print $2}'
> }
> CXX_CSTDLIB_HEADER="$(find_cxx_header cstdlib)"
> CXX_CMATH_HEADER="$(find_cxx_header cmath)"
Shouldn't this use $ac_cv_prog_AWK?
Thanks,
Florian
On 07/11/22 10:22, Florian Weimer wrote:
> * Adhemerval Zanella via Libc-alpha:
>
>> diff --git a/configure b/configure
>> index fc3d7842de..e23ea95a49 100755
>> --- a/configure
>> +++ b/configure
>> @@ -5669,8 +5669,8 @@ fi
>> # copy of those headers in Makerules.
>> if test -n "$CXX"; then
>> find_cxx_header () {
>> - echo "#include <$1>" | $CXX -M -MP -x c++ - 2>/dev/null \
>> - | sed -n "\,$1:,{s/:\$//;p}"
>> + echo "#include <$1>" | $CXX -H -fsyntax-only -x c++ - 2>&1 \
>> + | awk '$1 == "."{print $2}'
>> }
>> CXX_CSTDLIB_HEADER="$(find_cxx_header cstdlib)"
>> CXX_CMATH_HEADER="$(find_cxx_header cmath)"
>
> Shouldn't this use $ac_cv_prog_AWK?
It should be $AWK in fact, I will fix it before commit.
@@ -5669,8 +5669,8 @@ fi
# copy of those headers in Makerules.
if test -n "$CXX"; then
find_cxx_header () {
- echo "#include <$1>" | $CXX -M -MP -x c++ - 2>/dev/null \
- | sed -n "\,$1:,{s/:\$//;p}"
+ echo "#include <$1>" | $CXX -H -fsyntax-only -x c++ - 2>&1 \
+ | awk '$1 == "."{print $2}'
}
CXX_CSTDLIB_HEADER="$(find_cxx_header cstdlib)"
CXX_CMATH_HEADER="$(find_cxx_header cmath)"
@@ -1137,8 +1137,8 @@ AC_SUBST(CXX_SYSINCLUDES)
# copy of those headers in Makerules.
if test -n "$CXX"; then
find_cxx_header () {
- echo "#include <$1>" | $CXX -M -MP -x c++ - 2>/dev/null \
- | sed -n "\,$1:,{s/:\$//;p}"
+ echo "#include <$1>" | $CXX -H -fsyntax-only -x c++ - 2>&1 \
+ | awk '$1 == "."{print $2}'
}
CXX_CSTDLIB_HEADER="$(find_cxx_header cstdlib)"
CXX_CMATH_HEADER="$(find_cxx_header cmath)"