From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7854) id E5FF63857C5C; Wed, 12 Jan 2022 15:58:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E5FF63857C5C MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" From: =?iso-8859-1?q?Cl=E9ment_Chigot?= To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-6530] aix: handle 64bit inodes for include directories X-Act-Checkin: gcc X-Git-Author: =?utf-8?q?Cl=C3=A9ment_Chigot?= X-Git-Refname: refs/heads/master X-Git-Oldrev: 75845d584f490c294d40908168e5721adc38145d X-Git-Newrev: 14e0d8329750776a1807626867f87dacc102f9ed Message-Id: <20220112155801.E5FF63857C5C@sourceware.org> Date: Wed, 12 Jan 2022 15:58:01 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jan 2022 15:58:02 -0000 https://gcc.gnu.org/g:14e0d8329750776a1807626867f87dacc102f9ed commit r12-6530-g14e0d8329750776a1807626867f87dacc102f9ed Author: Clément Chigot Date: Thu May 6 16:08:15 2021 +0200 aix: handle 64bit inodes for include directories On AIX, stat will store inodes in 32bit even when using LARGE_FILES. If the inode is larger, it will return -1 in st_ino. Thus, in incpath.c when comparing include directories, if several of them have 64bit inodes, they will be considered as duplicated. gcc/ChangeLog: 2022-01-12 Clément Chigot * configure.ac: Check sizeof ino_t and dev_t. (HOST_STAT_FOR_64BIT_INODES): New AC_DEFINE to provide stat syscall being able to handle 64bit inodes. * config.in: Regenerate. * configure: Regenerate. * incpath.c (HOST_STAT_FOR_64BIT_INODES): New define. (remove_duplicates): Use it. libcpp/ChangeLog: 2022-01-12 Clément Chigot * configure.ac: Check sizeof ino_t and dev_t. * config.in: Regenerate. * configure: Regenerate. * include/cpplib.h (INO_T_CPP): Change for AIX. (DEV_T_CPP): New macro. (struct cpp_dir): Use it. Diff: --- gcc/config.in | 12 +++++++ gcc/configure | 83 +++++++++++++++++++++++++++++++++++++++++++++++-- gcc/configure.ac | 14 +++++++++ gcc/incpath.c | 8 +++-- libcpp/config.in | 6 ++++ libcpp/configure | 67 +++++++++++++++++++++++++++++++++++++++ libcpp/configure.ac | 3 ++ libcpp/include/cpplib.h | 10 +++++- 8 files changed, 198 insertions(+), 5 deletions(-) diff --git a/gcc/config.in b/gcc/config.in index d6adc7212a8..64c27c9cfac 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -2372,6 +2372,18 @@ #endif +/* The size of `dev_t', as computed by sizeof. */ +#ifndef USED_FOR_TARGET +#undef SIZEOF_DEV_T +#endif + + +/* The size of `ino_t', as computed by sizeof. */ +#ifndef USED_FOR_TARGET +#undef SIZEOF_INO_T +#endif + + /* The size of `int', as computed by sizeof. */ #ifndef USED_FOR_TARGET #undef SIZEOF_INT diff --git a/gcc/configure b/gcc/configure index 992a9d70092..d19059e13cc 100755 --- a/gcc/configure +++ b/gcc/configure @@ -6302,6 +6302,85 @@ rm -rf conftest* fi +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of ino_t" >&5 +$as_echo_n "checking size of ino_t... " >&6; } +if ${ac_cv_sizeof_ino_t+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_cxx_compute_int "$LINENO" "(long int) (sizeof (ino_t))" "ac_cv_sizeof_ino_t" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_ino_t" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (ino_t) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_ino_t=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_ino_t" >&5 +$as_echo "$ac_cv_sizeof_ino_t" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_INO_T $ac_cv_sizeof_ino_t +_ACEOF + + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of dev_t" >&5 +$as_echo_n "checking size of dev_t... " >&6; } +if ${ac_cv_sizeof_dev_t+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_cxx_compute_int "$LINENO" "(long int) (sizeof (dev_t))" "ac_cv_sizeof_dev_t" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_dev_t" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (dev_t) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_dev_t=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_dev_t" >&5 +$as_echo "$ac_cv_sizeof_dev_t" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_DEV_T $ac_cv_sizeof_dev_t +_ACEOF + + + +# Select the right stat being able to handle 64bit inodes, if needed. +if test "$enable_largefile" != no; then + case "$host, $build" in + *-*-aix*,*|*,*-*-aix*) + if test "$ac_cv_sizeof_ino_t" == "4" -a "$ac_cv_sizeof_dev_t" == 4; then + +$as_echo "#define HOST_STAT_FOR_64BIT_INODES stat64x" >>confdefs.h + + fi;; + esac +fi + # sizeof(char) is 1 by definition. # The cast to long int works around a bug in the HP C Compiler @@ -19561,7 +19640,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 19564 "configure" +#line 19643 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -19667,7 +19746,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 19670 "configure" +#line 19749 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff --git a/gcc/configure.ac b/gcc/configure.ac index 247371e6537..f2cd2f87750 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -465,6 +465,20 @@ AC_PROG_CPP AC_C_INLINE AC_SYS_LARGEFILE +AC_CHECK_SIZEOF(ino_t) +AC_CHECK_SIZEOF(dev_t) + +# Select the right stat being able to handle 64bit inodes, if needed. +if test "$enable_largefile" != no; then + case "$host, $build" in + *-*-aix*,*|*,*-*-aix*) + if test "$ac_cv_sizeof_ino_t" == "4" -a "$ac_cv_sizeof_dev_t" == 4; then + AC_DEFINE(HOST_STAT_FOR_64BIT_INODES, stat64x, + [Define which stat syscall is able to handle 64bit indodes.]) + fi;; + esac +fi + # sizeof(char) is 1 by definition. AC_CHECK_SIZEOF(void *) diff --git a/gcc/incpath.c b/gcc/incpath.c index 9ac55f83abc..12b16074f24 100644 --- a/gcc/incpath.c +++ b/gcc/incpath.c @@ -44,6 +44,10 @@ #define DIRS_EQ(A, B) (!filename_cmp ((A)->canonical_name, (B)->canonical_name)) #endif +#ifndef HOST_STAT_FOR_64BIT_INODES +#define HOST_STAT_FOR_64BIT_INODES stat +#endif + static const char dir_separator_str[] = { DIR_SEPARATOR, 0 }; static void add_env_var_paths (const char *, incpath_kind); @@ -246,7 +250,7 @@ remove_duplicates (cpp_reader *pfile, struct cpp_dir *head, int verbose) { struct cpp_dir **pcur, *tmp, *cur; - struct stat st; + struct HOST_STAT_FOR_64BIT_INODES st; for (pcur = &head; *pcur; ) { @@ -254,7 +258,7 @@ remove_duplicates (cpp_reader *pfile, struct cpp_dir *head, cur = *pcur; - if (stat (cur->name, &st)) + if (HOST_STAT_FOR_64BIT_INODES (cur->name, &st)) { /* Dirs that don't exist or have denied permissions are silently ignored, unless verbose. */ diff --git a/libcpp/config.in b/libcpp/config.in index 89aa6a1f30e..9983aee5912 100644 --- a/libcpp/config.in +++ b/libcpp/config.in @@ -258,6 +258,12 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION +/* The size of `dev_t', as computed by sizeof. */ +#undef SIZEOF_DEV_T + +/* The size of `ino_t', as computed by sizeof. */ +#undef SIZEOF_INO_T + /* The size of `int', as computed by sizeof. */ #undef SIZEOF_INT diff --git a/libcpp/configure b/libcpp/configure index 2797292679f..75145390215 100755 --- a/libcpp/configure +++ b/libcpp/configure @@ -6644,6 +6644,73 @@ $as_echo "#define HAVE_UCHAR 1" >>confdefs.h fi +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of ino_t" >&5 +$as_echo_n "checking size of ino_t... " >&6; } +if ${ac_cv_sizeof_ino_t+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (ino_t))" "ac_cv_sizeof_ino_t" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_ino_t" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (ino_t) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_ino_t=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_ino_t" >&5 +$as_echo "$ac_cv_sizeof_ino_t" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_INO_T $ac_cv_sizeof_ino_t +_ACEOF + + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of dev_t" >&5 +$as_echo_n "checking size of dev_t... " >&6; } +if ${ac_cv_sizeof_dev_t+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (dev_t))" "ac_cv_sizeof_dev_t" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_dev_t" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (dev_t) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_dev_t=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_dev_t" >&5 +$as_echo "$ac_cv_sizeof_dev_t" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_DEV_T $ac_cv_sizeof_dev_t +_ACEOF + + + # g++ on Solaris 10+ defines _XOPEN_SOURCE=600, which exposes a different # iconv() prototype. ac_ext=cpp diff --git a/libcpp/configure.ac b/libcpp/configure.ac index bc2373c8718..9b6042518e5 100644 --- a/libcpp/configure.ac +++ b/libcpp/configure.ac @@ -103,6 +103,9 @@ if test $ac_cv_type_uchar = yes; then [Define if defines \`uchar'.]) fi +AC_CHECK_SIZEOF(ino_t) +AC_CHECK_SIZEOF(dev_t) + # g++ on Solaris 10+ defines _XOPEN_SOURCE=600, which exposes a different # iconv() prototype. AC_LANG_PUSH([C++]) diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h index cb7ec17631a..ebf6fccc010 100644 --- a/libcpp/include/cpplib.h +++ b/libcpp/include/cpplib.h @@ -752,10 +752,18 @@ struct cpp_callbacks #ifdef VMS #define INO_T_CPP ino_t ino[3] +#elif defined (_AIX) && SIZEOF_INO_T == 4 +#define INO_T_CPP ino64_t ino #else #define INO_T_CPP ino_t ino #endif +#if defined (_AIX) && SIZEOF_DEV_T == 4 +#define DEV_T_CPP dev64_t dev +#else +#define DEV_T_CPP dev_t dev +#endif + /* Chain of directories to look for include files in. */ struct cpp_dir { @@ -790,7 +798,7 @@ struct cpp_dir /* The C front end uses these to recognize duplicated directories in the search path. */ INO_T_CPP; - dev_t dev; + DEV_T_CPP; }; /* The kind of the cpp_macro. */