[v2,1/2] gdb: remove some GCC version checks

Message ID 20240221164709.54212-1-simon.marchi@efficios.com
State New
Headers
Series [v2,1/2] gdb: remove some GCC version checks |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 warning Patch is already merged
linaro-tcwg-bot/tcwg_gdb_build--master-arm warning Patch is already merged

Commit Message

Simon Marchi Feb. 21, 2024, 4:46 p.m. UTC
  New in v2:

 - remove changes to nat/x86-gcc-cpuid.h
 - adjust indentation in tracepoint.h

Since we now require C++17, and therefore gcc >= 9, it's no longer
useful to have gcc version checks for older gcc version.

Change-Id: I3a87baa03c475f2b847b422b16b69c5ff7215b54
---
 gdb/unittests/enum-flags-selftests.c | 6 ------
 gdbserver/tracepoint.h               | 6 +-----
 gdbsupport/common-defs.h             | 9 ---------
 3 files changed, 1 insertion(+), 20 deletions(-)


base-commit: 99eeecc8d276e5af745e48825d66efff693a7678
  

Comments

Kevin Buettner Feb. 21, 2024, 5:09 p.m. UTC | #1
On Wed, 21 Feb 2024 11:46:51 -0500
Simon Marchi <simon.marchi@efficios.com> wrote:

> New in v2:
> 
>  - remove changes to nat/x86-gcc-cpuid.h
>  - adjust indentation in tracepoint.h
> 
> Since we now require C++17, and therefore gcc >= 9, it's no longer
> useful to have gcc version checks for older gcc version.

Both patches LGTM.

Reviewed-by: Kevin Buettner <kevinb@redhat.com>
  
Simon Marchi Feb. 21, 2024, 5:36 p.m. UTC | #2
On 2/21/24 12:09, Kevin Buettner wrote:
> On Wed, 21 Feb 2024 11:46:51 -0500
> Simon Marchi <simon.marchi@efficios.com> wrote:
> 
>> New in v2:
>>
>>  - remove changes to nat/x86-gcc-cpuid.h
>>  - adjust indentation in tracepoint.h
>>
>> Since we now require C++17, and therefore gcc >= 9, it's no longer
>> useful to have gcc version checks for older gcc version.
> 
> Both patches LGTM.
> 
> Reviewed-by: Kevin Buettner <kevinb@redhat.com>
> 

Thanks.  I'll wait for a confirmation from Pedro as well, since he gave
comment on v1.

Simon
  
Pedro Alves Feb. 21, 2024, 5:46 p.m. UTC | #3
On 2024-02-21 17:36, Simon Marchi wrote:
> On 2/21/24 12:09, Kevin Buettner wrote:
>> On Wed, 21 Feb 2024 11:46:51 -0500
>> Simon Marchi <simon.marchi@efficios.com> wrote:
>>
>>> New in v2:
>>>
>>>  - remove changes to nat/x86-gcc-cpuid.h
>>>  - adjust indentation in tracepoint.h
>>>
>>> Since we now require C++17, and therefore gcc >= 9, it's no longer
>>> useful to have gcc version checks for older gcc version.
>>
>> Both patches LGTM.
>>
>> Reviewed-by: Kevin Buettner <kevinb@redhat.com>
>>
> 
> Thanks.  I'll wait for a confirmation from Pedro as well, since he gave
> comment on v1.
> 

LGTM.

Approved-By: Pedro Alves <pedro@palves.net>
  
Simon Marchi Feb. 21, 2024, 6:31 p.m. UTC | #4
On 2024-02-21 12:46, Pedro Alves wrote:
> On 2024-02-21 17:36, Simon Marchi wrote:
>> On 2/21/24 12:09, Kevin Buettner wrote:
>>> On Wed, 21 Feb 2024 11:46:51 -0500
>>> Simon Marchi <simon.marchi@efficios.com> wrote:
>>>
>>>> New in v2:
>>>>
>>>>  - remove changes to nat/x86-gcc-cpuid.h
>>>>  - adjust indentation in tracepoint.h
>>>>
>>>> Since we now require C++17, and therefore gcc >= 9, it's no longer
>>>> useful to have gcc version checks for older gcc version.
>>>
>>> Both patches LGTM.
>>>
>>> Reviewed-by: Kevin Buettner <kevinb@redhat.com>
>>>
>>
>> Thanks.  I'll wait for a confirmation from Pedro as well, since he gave
>> comment on v1.
>>
> 
> LGTM.
> 
> Approved-By: Pedro Alves <pedro@palves.net>
> 

Thanks, pushed.

Simon
  

Patch

diff --git a/gdb/unittests/enum-flags-selftests.c b/gdb/unittests/enum-flags-selftests.c
index 853ebca37823..607b8ac66a64 100644
--- a/gdb/unittests/enum-flags-selftests.c
+++ b/gdb/unittests/enum-flags-selftests.c
@@ -253,10 +253,8 @@  CHECK_VALID (true,  EF,   true ? RE () : EF ())
 
 CHECK_VALID (true,  int,  true ? EF () : EF2 ())
 CHECK_VALID (true,  int,  true ? EF2 () : EF ())
-#if GCC_VERSION >= 5003 || defined __clang__
 CHECK_VALID (true,  int,  true ? EF () : RE2 ())
 CHECK_VALID (true,  int,  true ? RE2 () : EF ())
-#endif
 
 /* Same, but with an unsigned enum.  */
 
@@ -264,10 +262,8 @@  typedef unsigned int uns;
 
 CHECK_VALID (true,  uns,  true ? EF () : UEF ())
 CHECK_VALID (true,  uns,  true ? UEF () : EF ())
-#if GCC_VERSION >= 5003 || defined __clang__
 CHECK_VALID (true,  uns,  true ? EF () : URE ())
 CHECK_VALID (true,  uns,  true ? URE () : EF ())
-#endif
 
 /* Unfortunately this can't work due to the way C++ computes the
    return type of the ternary conditional operator.  int isn't
@@ -279,10 +275,8 @@  CHECK_VALID (true,  uns,  true ? URE () : EF ())
      error: operands to ?: have different types ‘enum_flags<RE>’ and ‘int’
    Confirmed to work with gcc 4.9, 5.3 and clang 3.7.
 */
-#if GCC_VERSION >= 4009 || defined __clang__
 CHECK_VALID (false, void, true ? EF () : 0)
 CHECK_VALID (false, void, true ? 0 : EF ())
-#endif
 
 /* Check that the ++/--/<</>>/<<=/>>= operators are deleted.  */
 
diff --git a/gdbserver/tracepoint.h b/gdbserver/tracepoint.h
index 8b232324d2ec..1660c9445ee5 100644
--- a/gdbserver/tracepoint.h
+++ b/gdbserver/tracepoint.h
@@ -38,11 +38,7 @@  void initialize_tracepoint (void);
 #if defined _WIN32 || defined __CYGWIN__
 # define EXPORTED_SYMBOL __declspec (dllexport)
 #else
-# if __GNUC__ >= 4
-#  define EXPORTED_SYMBOL __attribute__ ((visibility ("default")))
-# else
-#  define EXPORTED_SYMBOL
-# endif
+# define EXPORTED_SYMBOL __attribute__ ((visibility ("default")))
 #endif
 
 /* Use these to make sure the functions and variables the IPA needs to
diff --git a/gdbsupport/common-defs.h b/gdbsupport/common-defs.h
index 8ec559e9b680..6120719480b8 100644
--- a/gdbsupport/common-defs.h
+++ b/gdbsupport/common-defs.h
@@ -187,17 +187,8 @@ 
 #undef ATTRIBUTE_NONNULL
 #define ATTRIBUTE_NONNULL(m)
 
-#if GCC_VERSION >= 3004
 #define ATTRIBUTE_UNUSED_RESULT __attribute__ ((__warn_unused_result__))
-#else
-#define ATTRIBUTE_UNUSED_RESULT
-#endif
-
-#if (GCC_VERSION > 4000)
 #define ATTRIBUTE_USED __attribute__ ((__used__))
-#else
-#define ATTRIBUTE_USED
-#endif
 
 #include "libiberty.h"
 #include "pathmax.h"