Fold GCC_VERSION >= $old_version to TRUE, otherwise to FALSE.

Message ID adecb556-60b8-e18f-053c-bb88316920ea@suse.cz
State New
Headers
Series Fold GCC_VERSION >= $old_version to TRUE, otherwise to FALSE. |

Commit Message

Martin Liška May 5, 2022, 12:18 p.m. UTC
  Right now, the minimal required version of GCC is 4.8.x
that is a version that well supports c++11.

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

Ready to be installed?
Thanks,
Martin

gcc/ChangeLog:

	* bitmap.cc (bitmap_popcount):
	Fold GCC_VERSION >= $old_version to TRUE, otherwise to FALSE.
	(bitmap_count_bits_in_word): Likewise.
	(bitmap_single_bit_set_p): Likewise.
	(bitmap_first_set_bit): Likewise.
	(bitmap_last_set_bit): Likewise.
	* bitmap.h (if): Likewise.
	* config/ia64/ia64.cc (RWS_FIELD_TYPE): Likewise.
	* config/rs6000/rs6000.h (if): Likewise.
	* defaults.h: Likewise.
	* diagnostic-core.h (if): Likewise.
	(ATTRIBUTE_GCC_DIAG): Likewise.
	* dwarf2cfi.cc (if): Likewise.
	* dwarf2out.cc (if): Likewise.
	(DWARF2_ASM_LINE_DEBUG_INFO): Likewise.
	(DWARF2_ASM_VIEW_DEBUG_INFO): Likewise.
	* gcc.cc (if): Likewise.
	* genautomata.cc (struct state_ainsn_table): Likewise.
	(regexp_mode_check_failed): Likewise.
	(REGEXP_ONEOF): Likewise.
	* genconditions.cc (write_header): Likewise.
	(write_writer): Likewise.
	* genmatch.cc: Likewise.
	* genmodes.cc (GCC_INSN_MODES_INLINE_H): Likewise.
	* genoutput.cc (output_insn_data): Likewise.
	* ggc-page.cc (if): Likewise.
	(prefetch): Likewise.
	(ggc_internal_alloc): Likewise.
	* ggc-tests.cc (test_finalization): Likewise.
	* ggc.h (need_finalization_p): Likewise.
	* hwint.cc (floor_log2): Likewise.
	(ceil_log2): Likewise.
	(exact_log2): Likewise.
	(ctz_hwi): Likewise.
	(clz_hwi): Likewise.
	(ffs_hwi): Likewise.
	(popcount_hwi): Likewise.
	* hwint.h (HAVE_LONG_LONG): Likewise.
	(SIZEOF_LONG_LONG): Likewise.
	(sizeof_long_long_must_be_8[sizeof): Likewise.
	(clz_hwi): Likewise.
	(ctz_hwi): Likewise.
	(ffs_hwi): Likewise.
	(popcount_hwi): Likewise.
	(exact_log2): Likewise.
	(floor_log2): Likewise.
	(ceil_log2): Likewise.
	* ira-int.h: Likewise.
	* machmode.h (mode_to_bytes): Likewise.
	(mode_to_inner): Likewise.
	(mode_to_unit_size): Likewise.
	(mode_to_unit_precision): Likewise.
	(mode_to_nunits): Likewise.
	* output.h (ATTRIBUTE_ASM_FPRINTF): Likewise.
	* pretty-print.h (ATTRIBUTE_GCC_PPDIAG): Likewise.
	* rtl.cc (dump_rtx_statistics): Likewise.
	* rtl.h (test): Likewise.
	(RTX_FLAG): Likewise.
	(enum label_kind): Likewise.
	* sbitmap.cc (sbitmap_popcount): Likewise.
	(bitmap_count_bits): Likewise.
	* stringpool.h (get_identifier_with_length): Likewise.
	* system.h (HAVE_DESIGNATED_INITIALIZERS): Likewise.
	(HAVE_DESIGNATED_UNION_INITIALIZERS): Likewise.
	(if): Likewise.
	(__FUNCTION__): Likewise.
	(__builtin_expect): Likewise.
	(elif): Likewise.
	(gcc_assert): Likewise.
	(ALWAYS_INLINE): Likewise.
	(WARN_UNUSED_RESULT): Likewise.
	(STATIC_CONSTANT_P): Likewise.
	(defined): Likewise.
	(BROKEN_VALUE_INITIALIZATION): Likewise.
	(DEBUG_FUNCTION): Likewise.
	(DEBUG_VARIABLE): Likewise.
	* tree-vrp.cc (vrp_asserts::find_switch_asserts): Likewise.
	* tree.cc (get_file_function_name): Likewise.
	* tree.h (as_internal_fn): Likewise.
	(if): Likewise.
	(DECL_RTL_KNOWN_SET): Likewise.
	(prepare_target_option_nodes_for_pch): Likewise.
	(tree_operand_length): Likewise.
	(tree_to_poly_uint64): Likewise.
	* var-tracking.cc (int_mem_offset): Likewise.
	* vec.h (if): Likewise.
	* wide-int.cc (defined): Likewise.
	(if): Likewise.

gcc/cp/ChangeLog:

	* cp-tree.h (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK):
	Fold GCC_VERSION >= $old_version to TRUE, otherwise to FALSE.
	(STRIP_TEMPLATE): Likewise.
	* tree.cc (cp_tree_c_finish_parsing): Likewise.

gcc/fortran/ChangeLog:

	* gfortran.h (ATTRIBUTE_GCC_GFC):
	Fold GCC_VERSION >= $old_version to TRUE, otherwise to FALSE.

gcc/jit/ChangeLog:

	* jit-common.h (GNU_PRINTF):
	Fold GCC_VERSION >= $old_version to TRUE, otherwise to FALSE.
---
 gcc/bitmap.cc              |  73 +-------------------------
 gcc/bitmap.h               |  18 ++-----
 gcc/config/ia64/ia64.cc    |   5 +-
 gcc/config/rs6000/rs6000.h |   2 -
 gcc/cp/cp-tree.h           |   4 +-
 gcc/cp/tree.cc             |   2 +-
 gcc/defaults.h             |   2 +-
 gcc/diagnostic-core.h      |   4 --
 gcc/dwarf2cfi.cc           |   4 +-
 gcc/dwarf2out.cc           |  16 ++----
 gcc/fortran/gfortran.h     |   4 --
 gcc/gcc.cc                 |   2 -
 gcc/genautomata.cc         |   6 +--
 gcc/genconditions.cc       |   9 +---
 gcc/genmatch.cc            |  12 -----
 gcc/genmodes.cc            |   4 +-
 gcc/genoutput.cc           |   2 +-
 gcc/ggc-page.cc            |   9 ----
 gcc/ggc-tests.cc           |   2 -
 gcc/ggc.h                  |   4 --
 gcc/hwint.cc               | 104 -------------------------------------
 gcc/hwint.h                |  32 ++----------
 gcc/ira-int.h              |   6 +--
 gcc/jit/jit-common.h       |   4 --
 gcc/machmode.h             |  20 -------
 gcc/output.h               |   4 --
 gcc/pretty-print.h         |   4 --
 gcc/rtl.cc                 |   2 +-
 gcc/rtl.h                  |   6 +--
 gcc/sbitmap.cc             |  37 ++-----------
 gcc/stringpool.h           |   2 -
 gcc/system.h               |  62 +++-------------------
 gcc/tree-vrp.cc            |   5 --
 gcc/tree.cc                |   2 +-
 gcc/tree.h                 |  20 ++-----
 gcc/var-tracking.cc        |   2 +-
 gcc/vec.h                  |   8 +--
 gcc/wide-int.cc            |   2 +-
 38 files changed, 52 insertions(+), 454 deletions(-)
  

Comments

Richard Biener May 5, 2022, 12:24 p.m. UTC | #1
On Thu, May 5, 2022 at 2:19 PM Martin Liška <mliska@suse.cz> wrote:
>
> Right now, the minimal required version of GCC is 4.8.x
> that is a version that well supports c++11.

Hmm, but we support C++11 host compilers that are not GCC but
may claim to be, with GCC_VERSION 4.2.x for example.  Are we sure
all those liars implement what we guard with the version checks?

I suppose to be "correct" we'd at least need to preserve
#if __GNUC__
in places where we might use the host compiler?  (if compilers then lie
it's their own fault)

Richard.

> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>
> Ready to be installed?
> Thanks,
> Martin
>
> gcc/ChangeLog:
>
>         * bitmap.cc (bitmap_popcount):
>         Fold GCC_VERSION >= $old_version to TRUE, otherwise to FALSE.
>         (bitmap_count_bits_in_word): Likewise.
>         (bitmap_single_bit_set_p): Likewise.
>         (bitmap_first_set_bit): Likewise.
>         (bitmap_last_set_bit): Likewise.
>         * bitmap.h (if): Likewise.
>         * config/ia64/ia64.cc (RWS_FIELD_TYPE): Likewise.
>         * config/rs6000/rs6000.h (if): Likewise.
>         * defaults.h: Likewise.
>         * diagnostic-core.h (if): Likewise.
>         (ATTRIBUTE_GCC_DIAG): Likewise.
>         * dwarf2cfi.cc (if): Likewise.
>         * dwarf2out.cc (if): Likewise.
>         (DWARF2_ASM_LINE_DEBUG_INFO): Likewise.
>         (DWARF2_ASM_VIEW_DEBUG_INFO): Likewise.
>         * gcc.cc (if): Likewise.
>         * genautomata.cc (struct state_ainsn_table): Likewise.
>         (regexp_mode_check_failed): Likewise.
>         (REGEXP_ONEOF): Likewise.
>         * genconditions.cc (write_header): Likewise.
>         (write_writer): Likewise.
>         * genmatch.cc: Likewise.
>         * genmodes.cc (GCC_INSN_MODES_INLINE_H): Likewise.
>         * genoutput.cc (output_insn_data): Likewise.
>         * ggc-page.cc (if): Likewise.
>         (prefetch): Likewise.
>         (ggc_internal_alloc): Likewise.
>         * ggc-tests.cc (test_finalization): Likewise.
>         * ggc.h (need_finalization_p): Likewise.
>         * hwint.cc (floor_log2): Likewise.
>         (ceil_log2): Likewise.
>         (exact_log2): Likewise.
>         (ctz_hwi): Likewise.
>         (clz_hwi): Likewise.
>         (ffs_hwi): Likewise.
>         (popcount_hwi): Likewise.
>         * hwint.h (HAVE_LONG_LONG): Likewise.
>         (SIZEOF_LONG_LONG): Likewise.
>         (sizeof_long_long_must_be_8[sizeof): Likewise.
>         (clz_hwi): Likewise.
>         (ctz_hwi): Likewise.
>         (ffs_hwi): Likewise.
>         (popcount_hwi): Likewise.
>         (exact_log2): Likewise.
>         (floor_log2): Likewise.
>         (ceil_log2): Likewise.
>         * ira-int.h: Likewise.
>         * machmode.h (mode_to_bytes): Likewise.
>         (mode_to_inner): Likewise.
>         (mode_to_unit_size): Likewise.
>         (mode_to_unit_precision): Likewise.
>         (mode_to_nunits): Likewise.
>         * output.h (ATTRIBUTE_ASM_FPRINTF): Likewise.
>         * pretty-print.h (ATTRIBUTE_GCC_PPDIAG): Likewise.
>         * rtl.cc (dump_rtx_statistics): Likewise.
>         * rtl.h (test): Likewise.
>         (RTX_FLAG): Likewise.
>         (enum label_kind): Likewise.
>         * sbitmap.cc (sbitmap_popcount): Likewise.
>         (bitmap_count_bits): Likewise.
>         * stringpool.h (get_identifier_with_length): Likewise.
>         * system.h (HAVE_DESIGNATED_INITIALIZERS): Likewise.
>         (HAVE_DESIGNATED_UNION_INITIALIZERS): Likewise.
>         (if): Likewise.
>         (__FUNCTION__): Likewise.
>         (__builtin_expect): Likewise.
>         (elif): Likewise.
>         (gcc_assert): Likewise.
>         (ALWAYS_INLINE): Likewise.
>         (WARN_UNUSED_RESULT): Likewise.
>         (STATIC_CONSTANT_P): Likewise.
>         (defined): Likewise.
>         (BROKEN_VALUE_INITIALIZATION): Likewise.
>         (DEBUG_FUNCTION): Likewise.
>         (DEBUG_VARIABLE): Likewise.
>         * tree-vrp.cc (vrp_asserts::find_switch_asserts): Likewise.
>         * tree.cc (get_file_function_name): Likewise.
>         * tree.h (as_internal_fn): Likewise.
>         (if): Likewise.
>         (DECL_RTL_KNOWN_SET): Likewise.
>         (prepare_target_option_nodes_for_pch): Likewise.
>         (tree_operand_length): Likewise.
>         (tree_to_poly_uint64): Likewise.
>         * var-tracking.cc (int_mem_offset): Likewise.
>         * vec.h (if): Likewise.
>         * wide-int.cc (defined): Likewise.
>         (if): Likewise.
>
> gcc/cp/ChangeLog:
>
>         * cp-tree.h (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK):
>         Fold GCC_VERSION >= $old_version to TRUE, otherwise to FALSE.
>         (STRIP_TEMPLATE): Likewise.
>         * tree.cc (cp_tree_c_finish_parsing): Likewise.
>
> gcc/fortran/ChangeLog:
>
>         * gfortran.h (ATTRIBUTE_GCC_GFC):
>         Fold GCC_VERSION >= $old_version to TRUE, otherwise to FALSE.
>
> gcc/jit/ChangeLog:
>
>         * jit-common.h (GNU_PRINTF):
>         Fold GCC_VERSION >= $old_version to TRUE, otherwise to FALSE.
> ---
>  gcc/bitmap.cc              |  73 +-------------------------
>  gcc/bitmap.h               |  18 ++-----
>  gcc/config/ia64/ia64.cc    |   5 +-
>  gcc/config/rs6000/rs6000.h |   2 -
>  gcc/cp/cp-tree.h           |   4 +-
>  gcc/cp/tree.cc             |   2 +-
>  gcc/defaults.h             |   2 +-
>  gcc/diagnostic-core.h      |   4 --
>  gcc/dwarf2cfi.cc           |   4 +-
>  gcc/dwarf2out.cc           |  16 ++----
>  gcc/fortran/gfortran.h     |   4 --
>  gcc/gcc.cc                 |   2 -
>  gcc/genautomata.cc         |   6 +--
>  gcc/genconditions.cc       |   9 +---
>  gcc/genmatch.cc            |  12 -----
>  gcc/genmodes.cc            |   4 +-
>  gcc/genoutput.cc           |   2 +-
>  gcc/ggc-page.cc            |   9 ----
>  gcc/ggc-tests.cc           |   2 -
>  gcc/ggc.h                  |   4 --
>  gcc/hwint.cc               | 104 -------------------------------------
>  gcc/hwint.h                |  32 ++----------
>  gcc/ira-int.h              |   6 +--
>  gcc/jit/jit-common.h       |   4 --
>  gcc/machmode.h             |  20 -------
>  gcc/output.h               |   4 --
>  gcc/pretty-print.h         |   4 --
>  gcc/rtl.cc                 |   2 +-
>  gcc/rtl.h                  |   6 +--
>  gcc/sbitmap.cc             |  37 ++-----------
>  gcc/stringpool.h           |   2 -
>  gcc/system.h               |  62 +++-------------------
>  gcc/tree-vrp.cc            |   5 --
>  gcc/tree.cc                |   2 +-
>  gcc/tree.h                 |  20 ++-----
>  gcc/var-tracking.cc        |   2 +-
>  gcc/vec.h                  |   8 +--
>  gcc/wide-int.cc            |   2 +-
>  38 files changed, 52 insertions(+), 454 deletions(-)
>
> diff --git a/gcc/bitmap.cc b/gcc/bitmap.cc
> index 88c329f9325..a19d8cddea5 100644
> --- a/gcc/bitmap.cc
> +++ b/gcc/bitmap.cc
> @@ -1081,33 +1081,6 @@ bitmap_get_aligned_chunk (const_bitmap head, unsigned int chunk,
>    return (ptr->bits[word_num] >> bit_num) & max_value;
>  }
>
> -#if GCC_VERSION < 3400
> -/* Table of number of set bits in a character, indexed by value of char.  */
> -static const unsigned char popcount_table[] =
> -{
> -    0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,
> -    1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
> -    1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
> -    2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
> -    1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
> -    2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
> -    2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
> -    3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,4,5,5,6,5,6,6,7,5,6,6,7,6,7,7,8,
> -};
> -
> -static unsigned long
> -bitmap_popcount (BITMAP_WORD a)
> -{
> -  unsigned long ret = 0;
> -  unsigned i;
> -
> -  /* Just do this the table way for now  */
> -  for (i = 0; i < BITMAP_WORD_BITS; i+= 8)
> -    ret += popcount_table[(a >> i) & 0xff];
> -  return ret;
> -}
> -#endif
> -
>  /* Count and return the number of bits set in the bitmap word BITS.  */
>  static unsigned long
>  bitmap_count_bits_in_word (const BITMAP_WORD *bits)
> @@ -1116,13 +1089,9 @@ bitmap_count_bits_in_word (const BITMAP_WORD *bits)
>
>    for (unsigned ix = 0; ix != BITMAP_ELEMENT_WORDS; ix++)
>      {
> -#if GCC_VERSION >= 3400
>        /* Note that popcountl matches BITMAP_WORD in type, so the actual size
>          of BITMAP_WORD is not material.  */
>        count += __builtin_popcountl (bits[ix]);
> -#else
> -      count += bitmap_popcount (bits[ix]);
> -#endif
>      }
>    return count;
>  }
> @@ -1201,13 +1170,9 @@ bitmap_single_bit_set_p (const_bitmap a)
>
>    for (ix = 0; ix != BITMAP_ELEMENT_WORDS; ix++)
>      {
> -#if GCC_VERSION >= 3400
>        /* Note that popcountl matches BITMAP_WORD in type, so the actual size
>          of BITMAP_WORD is not material.  */
>        count += __builtin_popcountl (elt->bits[ix]);
> -#else
> -      count += bitmap_popcount (elt->bits[ix]);
> -#endif
>        if (count > 1)
>         return false;
>      }
> @@ -1244,31 +1209,9 @@ bitmap_first_set_bit (const_bitmap a)
>   found_bit:
>    bit_no += ix * BITMAP_WORD_BITS;
>
> -#if GCC_VERSION >= 3004
>    gcc_assert (sizeof (long) == sizeof (word));
>    bit_no += __builtin_ctzl (word);
> -#else
> -  /* Binary search for the first set bit.  */
> -#if BITMAP_WORD_BITS > 64
> -#error "Fill out the table."
> -#endif
> -#if BITMAP_WORD_BITS > 32
> -  if (!(word & 0xffffffff))
> -    word >>= 32, bit_no += 32;
> -#endif
> -  if (!(word & 0xffff))
> -    word >>= 16, bit_no += 16;
> -  if (!(word & 0xff))
> -    word >>= 8, bit_no += 8;
> -  if (!(word & 0xf))
> -    word >>= 4, bit_no += 4;
> -  if (!(word & 0x3))
> -    word >>= 2, bit_no += 2;
> -  if (!(word & 0x1))
> -    word >>= 1, bit_no += 1;
> -
> - gcc_checking_assert (word & 1);
> -#endif
> +
>   return bit_no;
>  }
>
> @@ -1302,22 +1245,8 @@ bitmap_last_set_bit (const_bitmap a)
>    gcc_assert (elt->bits[ix] != 0);
>   found_bit:
>    bit_no += ix * BITMAP_WORD_BITS;
> -#if GCC_VERSION >= 3004
>    gcc_assert (sizeof (long) == sizeof (word));
>    bit_no += BITMAP_WORD_BITS - __builtin_clzl (word) - 1;
> -#else
> -  /* Hopefully this is a twos-complement host...  */
> -  BITMAP_WORD x = word;
> -  x |= (x >> 1);
> -  x |= (x >> 2);
> -  x |= (x >> 4);
> -  x |= (x >> 8);
> -  x |= (x >> 16);
> -#if BITMAP_WORD_BITS > 32
> -  x |= (x >> 32);
> -#endif
> -  bit_no += bitmap_popcount (x) - 1;
> -#endif
>
>    return bit_no;
>  }
> diff --git a/gcc/bitmap.h b/gcc/bitmap.h
> index 7fba443aff1..e7bf67a5474 100644
> --- a/gcc/bitmap.h
> +++ b/gcc/bitmap.h
> @@ -708,20 +708,10 @@ bmp_iter_next (bitmap_iterator *bi, unsigned *bit_no)
>  static inline void
>  bmp_iter_next_bit (bitmap_iterator * bi, unsigned *bit_no)
>  {
> -#if (GCC_VERSION >= 3004)
> -  {
> -    unsigned int n = __builtin_ctzl (bi->bits);
> -    gcc_assert (sizeof (unsigned long) == sizeof (BITMAP_WORD));
> -    bi->bits >>= n;
> -    *bit_no += n;
> -  }
> -#else
> -  while (!(bi->bits & 1))
> -    {
> -      bi->bits >>= 1;
> -      *bit_no += 1;
> -    }
> -#endif
> +  unsigned int n = __builtin_ctzl (bi->bits);
> +  gcc_assert (sizeof (unsigned long) == sizeof (BITMAP_WORD));
> +  bi->bits >>= n;
> +  *bit_no += n;
>  }
>
>  /* Advance to the next nonzero bit of a single bitmap, we will have
> diff --git a/gcc/config/ia64/ia64.cc b/gcc/config/ia64/ia64.cc
> index f9fb681a36c..445a391f0f8 100644
> --- a/gcc/config/ia64/ia64.cc
> +++ b/gcc/config/ia64/ia64.cc
> @@ -6213,11 +6213,8 @@ ia64_safe_type (rtx_insn *insn)
>     If a predicate register is written by an AND.ORCM we set WRITTEN_BY_AND
>     to true; if it was written by an OR.ANDCM we set WRITTEN_BY_OR to true.  */
>
> -#if GCC_VERSION >= 4000
>  #define RWS_FIELD_TYPE __extension__ unsigned short
> -#else
> -#define RWS_FIELD_TYPE unsigned int
> -#endif
> +
>  struct reg_write_state
>  {
>    RWS_FIELD_TYPE write_count : 2;
> diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h
> index 523256a5c9d..4e83372a291 100644
> --- a/gcc/config/rs6000/rs6000.h
> +++ b/gcc/config/rs6000/rs6000.h
> @@ -2586,9 +2586,7 @@ typedef struct GTY(()) machine_function
>
>  #define TARGET_SUPPORTS_WIDE_INT 1
>
> -#if (GCC_VERSION >= 3000)
>  #pragma GCC poison TARGET_FLOAT128 OPTION_MASK_FLOAT128 MASK_FLOAT128
> -#endif
>
>  /* Whether a given VALUE is a valid 16 or 34-bit signed integer.  */
>  #define SIGNED_INTEGER_NBIT_P(VALUE, N)                                        \
> diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
> index 663fe7a20fc..e9c3cf2bad0 100644
> --- a/gcc/cp/cp-tree.h
> +++ b/gcc/cp/cp-tree.h
> @@ -631,7 +631,7 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX];
>  #define BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK(NODE) \
>    TREE_CHECK(NODE,BOUND_TEMPLATE_TEMPLATE_PARM)
>
> -#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
> +#if defined ENABLE_TREE_CHECKING
>
>  /* Returns t iff the node can have a TEMPLATE_INFO field.  */
>
> @@ -2989,7 +2989,7 @@ struct GTY(()) lang_decl {
>  #define STRIP_TEMPLATE(NODE) \
>    (TREE_CODE (NODE) == TEMPLATE_DECL ? DECL_TEMPLATE_RESULT (NODE) : NODE)
>
> -#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
> +#if defined ENABLE_TREE_CHECKING
>
>  #define LANG_DECL_MIN_CHECK(NODE) __extension__                        \
>  ({ struct lang_decl *lt = DECL_LANG_SPECIFIC (NODE);           \
> diff --git a/gcc/cp/tree.cc b/gcc/cp/tree.cc
> index ed0d0d22950..98175bfeb11 100644
> --- a/gcc/cp/tree.cc
> +++ b/gcc/cp/tree.cc
> @@ -6129,7 +6129,7 @@ cp_tree_c_finish_parsing ()
>    deleted_copy_types = NULL;
>  }
>
> -#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
> +#if defined ENABLE_TREE_CHECKING
>  /* Complain that some language-specific thing hanging off a tree
>     node has been accessed improperly.  */
>
> diff --git a/gcc/defaults.h b/gcc/defaults.h
> index 7c7a80e596e..fbd4d8e5ae6 100644
> --- a/gcc/defaults.h
> +++ b/gcc/defaults.h
> @@ -949,7 +949,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
>  #define DEFAULT_USE_CXA_ATEXIT 0
>  #endif
>
> -#if GCC_VERSION >= 3000 && defined IN_GCC
> +#ifdef IN_GCC
>  /* These old constraint macros shouldn't appear anywhere in a
>     configuration using MD constraint definitions.  */
>  #endif
> diff --git a/gcc/diagnostic-core.h b/gcc/diagnostic-core.h
> index 286954ac2f8..0df0c896406 100644
> --- a/gcc/diagnostic-core.h
> +++ b/gcc/diagnostic-core.h
> @@ -60,11 +60,7 @@ extern const char *trim_filename (const char *);
>  /* None of these functions are suitable for ATTRIBUTE_PRINTF, because
>     each language front end can extend them with its own set of format
>     specifiers.  We must use custom format checks.  */
> -#if (CHECKING_P && GCC_VERSION >= 4001) || GCC_VERSION == BUILDING_GCC_VERSION
>  #define ATTRIBUTE_GCC_DIAG(m, n) __attribute__ ((__format__ (GCC_DIAG_STYLE, m, n))) ATTRIBUTE_NONNULL(m)
> -#else
> -#define ATTRIBUTE_GCC_DIAG(m, n) ATTRIBUTE_NONNULL(m)
> -#endif
>  extern void internal_error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2)
>       ATTRIBUTE_NORETURN;
>  extern void internal_error_no_backtrace (const char *, ...)
> diff --git a/gcc/dwarf2cfi.cc b/gcc/dwarf2cfi.cc
> index ab7c5cc5b27..6aae3bdb5aa 100644
> --- a/gcc/dwarf2cfi.cc
> +++ b/gcc/dwarf2cfi.cc
> @@ -45,9 +45,7 @@ along with GCC; see the file COPYING3.  If not see
>     totally replaced in this file; make sure it stays that way.  */
>  #undef DWARF2_UNWIND_INFO
>  #undef DWARF2_FRAME_INFO
> -#if (GCC_VERSION >= 3000)
> - #pragma GCC poison DWARF2_UNWIND_INFO DWARF2_FRAME_INFO
> -#endif
> +#pragma GCC poison DWARF2_UNWIND_INFO DWARF2_FRAME_INFO
>
>  #ifndef INCOMING_RETURN_ADDR_RTX
>  #define INCOMING_RETURN_ADDR_RTX  (gcc_unreachable (), NULL_RTX)
> diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc
> index 5681b01749a..d31818f999d 100644
> --- a/gcc/dwarf2out.cc
> +++ b/gcc/dwarf2out.cc
> @@ -133,9 +133,7 @@ int vms_file_stats_name (const char *, long long *, long *, char *, int *);
>     totally replaced in this file; make sure it stays that way.  */
>  #undef DWARF2_UNWIND_INFO
>  #undef DWARF2_FRAME_INFO
> -#if (GCC_VERSION >= 3000)
> - #pragma GCC poison DWARF2_UNWIND_INFO DWARF2_FRAME_INFO
> -#endif
> +#pragma GCC poison DWARF2_UNWIND_INFO DWARF2_FRAME_INFO
>
>  /* The size of the target's pointer type.  */
>  #ifndef PTR_SIZE
> @@ -3370,10 +3368,8 @@ bool
>  dwarf2out_default_as_loc_support (void)
>  {
>    return DWARF2_ASM_LINE_DEBUG_INFO;
> -#if (GCC_VERSION >= 3000)
> -# undef DWARF2_ASM_LINE_DEBUG_INFO
> -# pragma GCC poison DWARF2_ASM_LINE_DEBUG_INFO
> -#endif
> +#undef DWARF2_ASM_LINE_DEBUG_INFO
> +#pragma GCC poison DWARF2_ASM_LINE_DEBUG_INFO
>  }
>
>  /* Return true if GCC configure detected assembler support for views
> @@ -3383,10 +3379,8 @@ bool
>  dwarf2out_default_as_locview_support (void)
>  {
>    return DWARF2_ASM_VIEW_DEBUG_INFO;
> -#if (GCC_VERSION >= 3000)
> -# undef DWARF2_ASM_VIEW_DEBUG_INFO
> -# pragma GCC poison DWARF2_ASM_VIEW_DEBUG_INFO
> -#endif
> +#undef DWARF2_ASM_VIEW_DEBUG_INFO
> +#pragma GCC poison DWARF2_ASM_VIEW_DEBUG_INFO
>  }
>
>  /* A bit is set in ZERO_VIEW_P if we are using the assembler-supported
> diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
> index 7bf1d5a0452..7baab4bfceb 100644
> --- a/gcc/fortran/gfortran.h
> +++ b/gcc/fortran/gfortran.h
> @@ -1072,11 +1072,7 @@ typedef struct
>
>  /* In order for the "gfc" format checking to work correctly, you must
>     have declared a typedef locus first.  */
> -#if GCC_VERSION >= 4001
>  #define ATTRIBUTE_GCC_GFC(m, n) __attribute__ ((__format__ (__gcc_gfc__, m, n))) ATTRIBUTE_NONNULL(m)
> -#else
> -#define ATTRIBUTE_GCC_GFC(m, n) ATTRIBUTE_NONNULL(m)
> -#endif
>
>
>  /* Suppress error messages or re-enable them.  */
> diff --git a/gcc/gcc.cc b/gcc/gcc.cc
> index bb07cc244e3..c5b92b380b2 100644
> --- a/gcc/gcc.cc
> +++ b/gcc/gcc.cc
> @@ -163,9 +163,7 @@ env_manager::restore ()
>  }
>
>  /* Forbid other uses of getenv and putenv.  */
> -#if (GCC_VERSION >= 3000)
>  #pragma GCC poison getenv putenv
> -#endif
>
>
>
> diff --git a/gcc/genautomata.cc b/gcc/genautomata.cc
> index e43314e4ea3..a290122f62c 100644
> --- a/gcc/genautomata.cc
> +++ b/gcc/genautomata.cc
> @@ -879,7 +879,7 @@ struct state_ainsn_table
>  /* Macros to access members of unions.  Use only them for access to
>     union members of declarations and regexps.  */
>
> -#if CHECKING_P && (GCC_VERSION >= 2007)
> +#if CHECKING_P
>
>  #define DECL_UNIT(d) __extension__                                     \
>  (({ __typeof (d) const _decl = (d);                                    \
> @@ -1070,7 +1070,7 @@ regexp_mode_check_failed (enum regexp_mode mode,
>    exit (1);
>  }
>
> -#else /* #if CHECKING_P && (GCC_VERSION >= 2007) */
> +#else /* #if CHECKING_P */
>
>  #define DECL_UNIT(d) (&(d)->decl.unit)
>  #define DECL_BYPASS(d) (&(d)->decl.bypass)
> @@ -1088,7 +1088,7 @@ regexp_mode_check_failed (enum regexp_mode mode,
>  #define REGEXP_ALLOF(r) (&(r)->regexp.allof)
>  #define REGEXP_ONEOF(r) (&(r)->regexp.oneof)
>
> -#endif /* #if CHECKING_P && (GCC_VERSION >= 2007) */
> +#endif /* #if CHECKING_P */
>
>  #define XCREATENODE(T) ((T *) create_node (sizeof (T)))
>  #define XCREATENODEVEC(T, N) ((T *) create_node (sizeof (T) * (N)))
> diff --git a/gcc/genconditions.cc b/gcc/genconditions.cc
> index f63a3f495c5..8845309fd91 100644
> --- a/gcc/genconditions.cc
> +++ b/gcc/genconditions.cc
> @@ -58,7 +58,6 @@ write_header (void)
>  /* It is necessary, but not entirely safe, to include the headers below\n\
>     in a generator program.  As a defensive measure, don't do so when the\n\
>     table isn't going to have anything in it.  */\n\
> -#if GCC_VERSION >= 3001\n\
>  \n\
>  /* Do not allow checking to confuse the issue.  */\n\
>  #undef CHECKING_P\n\
> @@ -108,8 +107,7 @@ write_header (void)
>  extern rtx_insn *insn;\n\
>  extern rtx ins1;\n\
>  extern rtx operands[];\n\
> -\n\
> -#endif /* gcc >= 3.0.1 */\n");
> +\n");
>  }
>
>  /* Write out one entry in the conditions table, using the data pointed
> @@ -170,12 +168,11 @@ struct c_test\n\
>     vary at run time.  It works in 3.0.1 and later; 3.0 only when not\n\
>     optimizing.  */\n\
>  \n\
> -#if GCC_VERSION >= 3001\n\
>  static const struct c_test insn_conditions[] = {\n");
>
>    traverse_c_tests (write_one_condition, 0);
>
> -  puts ("  { nullptr, -1 }\n};\n#endif /* gcc >= 3.0.1 */\n");
> +  puts ("  { nullptr, -1 }\n};\n");
>  }
>
>  /* Emit code which will convert the C-format table to a
> @@ -191,7 +188,6 @@ write_writer (void)
>         "  unsigned int i;\n"
>          "  const char *p;\n"
>          "  puts (\"(define_conditions [\");\n"
> -       "#if GCC_VERSION >= 3001\n"
>         "  for (i = 0; i < ARRAY_SIZE (insn_conditions) - 1; i++)\n"
>         "    {\n"
>         "      printf (\"  (%d \\\"\", insn_conditions[i].value);\n"
> @@ -207,7 +203,6 @@ write_writer (void)
>         "        }\n"
>          "      puts (\"\\\")\");\n"
>          "    }\n"
> -       "#endif /* gcc >= 3.0.1 */\n"
>         "  puts (\"])\");\n"
>          "  fflush (stdout);\n"
>          "return ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE;\n"
> diff --git a/gcc/genmatch.cc b/gcc/genmatch.cc
> index 2eda7300821..a10a51b0c13 100644
> --- a/gcc/genmatch.cc
> +++ b/gcc/genmatch.cc
> @@ -70,9 +70,7 @@ linemap_client_expand_location_to_spelling_point (location_t loc,
>  }
>
>  static bool
> -#if GCC_VERSION >= 4001
>  __attribute__((format (printf, 5, 0)))
> -#endif
>  diagnostic_cb (cpp_reader *, enum cpp_diagnostic_level errtype,
>                enum cpp_warning_reason, rich_location *richloc,
>                const char *msg, va_list *ap)
> @@ -115,9 +113,7 @@ notfound:
>  }
>
>  static void
> -#if GCC_VERSION >= 4001
>  __attribute__((format (printf, 2, 3)))
> -#endif
>  fatal_at (const cpp_token *tk, const char *msg, ...)
>  {
>    rich_location richloc (line_table, tk->src_loc);
> @@ -128,9 +124,7 @@ fatal_at (const cpp_token *tk, const char *msg, ...)
>  }
>
>  static void
> -#if GCC_VERSION >= 4001
>  __attribute__((format (printf, 2, 3)))
> -#endif
>  fatal_at (location_t loc, const char *msg, ...)
>  {
>    rich_location richloc (line_table, loc);
> @@ -141,9 +135,7 @@ fatal_at (location_t loc, const char *msg, ...)
>  }
>
>  static void
> -#if GCC_VERSION >= 4001
>  __attribute__((format (printf, 2, 3)))
> -#endif
>  warning_at (const cpp_token *tk, const char *msg, ...)
>  {
>    rich_location richloc (line_table, tk->src_loc);
> @@ -154,9 +146,7 @@ warning_at (const cpp_token *tk, const char *msg, ...)
>  }
>
>  static void
> -#if GCC_VERSION >= 4001
>  __attribute__((format (printf, 2, 3)))
> -#endif
>  warning_at (location_t loc, const char *msg, ...)
>  {
>    rich_location richloc (line_table, loc);
> @@ -169,9 +159,7 @@ warning_at (location_t loc, const char *msg, ...)
>  /* Like fprintf, but print INDENT spaces at the beginning.  */
>
>  static void
> -#if GCC_VERSION >= 4001
>  __attribute__((format (printf, 3, 4)))
> -#endif
>  fprintf_indent (FILE *f, unsigned int indent, const char *format, ...)
>  {
>    va_list ap;
> diff --git a/gcc/genmodes.cc b/gcc/genmodes.cc
> index 59850bb070a..0f4d746c157 100644
> --- a/gcc/genmodes.cc
> +++ b/gcc/genmodes.cc
> @@ -1399,13 +1399,13 @@ emit_insn_modes_inline_h (void)
>  #ifndef GCC_INSN_MODES_INLINE_H\n\
>  #define GCC_INSN_MODES_INLINE_H");
>
> -  puts ("\n#if !defined (USED_FOR_TARGET) && GCC_VERSION >= 4001\n");
> +  puts ("\n#if !defined (USED_FOR_TARGET)\n");
>    emit_mode_size_inline ();
>    emit_mode_nunits_inline ();
>    emit_mode_inner_inline ();
>    emit_mode_unit_size_inline ();
>    emit_mode_unit_precision_inline ();
> -  puts ("#endif /* GCC_VERSION >= 4001 */");
> +  puts ("#endif");
>
>    puts ("\
>  \n\
> diff --git a/gcc/genoutput.cc b/gcc/genoutput.cc
> index 6bb03e2864f..853bec0201d 100644
> --- a/gcc/genoutput.cc
> +++ b/gcc/genoutput.cc
> @@ -291,7 +291,7 @@ output_insn_data (void)
>         break;
>        }
>
> -  printf ("#if GCC_VERSION >= 2007\n__extension__\n#endif\n");
> +  printf ("\n__extension__\n");
>    printf ("\nconst struct insn_data_d insn_data[] = \n{\n");
>
>    for (d = idata; d; d = d->next)
> diff --git a/gcc/ggc-page.cc b/gcc/ggc-page.cc
> index 7a7a1b0901f..8fe07b80066 100644
> --- a/gcc/ggc-page.cc
> +++ b/gcc/ggc-page.cc
> @@ -568,11 +568,7 @@ push_by_depth (page_entry *p, unsigned long *s)
>    G.save_in_use[G.by_depth_in_use++] = s;
>  }
>
> -#if (GCC_VERSION < 3001)
> -#define prefetch(X) ((void) X)
> -#else
>  #define prefetch(X) __builtin_prefetch (X)
> -#endif
>
>  #define save_in_use_p_i(__i) \
>    (G.save_in_use[__i])
> @@ -1340,12 +1336,7 @@ ggc_internal_alloc (size_t size, void (*f)(void *), size_t s, size_t n
>           while (~entry->in_use_p[word] == 0)
>             ++word;
>
> -#if GCC_VERSION >= 3004
>           bit = __builtin_ctzl (~entry->in_use_p[word]);
> -#else
> -         while ((entry->in_use_p[word] >> bit) & 1)
> -           ++bit;
> -#endif
>
>           hint = word * HOST_BITS_PER_LONG + bit;
>         }
> diff --git a/gcc/ggc-tests.cc b/gcc/ggc-tests.cc
> index 620989489b6..d028da339e6 100644
> --- a/gcc/ggc-tests.cc
> +++ b/gcc/ggc-tests.cc
> @@ -180,10 +180,8 @@ int test_struct_with_dtor::dtor_call_count;
>  static void
>  test_finalization ()
>  {
> -#if GCC_VERSION >= 4003
>    ASSERT_FALSE (need_finalization_p <test_struct> ());
>    ASSERT_TRUE (need_finalization_p <test_struct_with_dtor> ());
> -#endif
>
>    /* Create some garbage.  */
>    const int count = 10;
> diff --git a/gcc/ggc.h b/gcc/ggc.h
> index aeec1bafb9b..0f72f368a72 100644
> --- a/gcc/ggc.h
> +++ b/gcc/ggc.h
> @@ -170,11 +170,7 @@ template<typename T>
>  inline bool
>  need_finalization_p ()
>  {
> -#if GCC_VERSION >= 4003
>    return !__has_trivial_destructor (T);
> -#else
> -  return true;
> -#endif
>  }
>
>  template<typename T>
> diff --git a/gcc/hwint.cc b/gcc/hwint.cc
> index e53e0bf7906..fa2df400842 100644
> --- a/gcc/hwint.cc
> +++ b/gcc/hwint.cc
> @@ -21,110 +21,6 @@ along with GCC; see the file COPYING3.  If not see
>  #include "system.h"
>  #include "coretypes.h"
>
> -#if GCC_VERSION < 3004
> -
> -/* The functions clz_hwi, ctz_hwi, ffs_hwi, floor_log2, ceil_log2,
> -   and exact_log2 are defined as inline functions in hwint.h
> -   if GCC_VERSION >= 3004.
> -   The definitions here are used for older versions of GCC and
> -   non-GCC bootstrap compilers.  */
> -
> -/* Given X, an unsigned number, return the largest int Y such that 2**Y <= X.
> -   If X is 0, return -1.  */
> -
> -int
> -floor_log2 (unsigned HOST_WIDE_INT x)
> -{
> -  int t = 0;
> -
> -  if (x == 0)
> -    return -1;
> -
> -  if (HOST_BITS_PER_WIDE_INT > 64)
> -    if (x >= HOST_WIDE_INT_1U << (t + 64))
> -      t += 64;
> -  if (HOST_BITS_PER_WIDE_INT > 32)
> -    if (x >= HOST_WIDE_INT_1U << (t + 32))
> -      t += 32;
> -  if (x >= HOST_WIDE_INT_1U << (t + 16))
> -    t += 16;
> -  if (x >= HOST_WIDE_INT_1U << (t + 8))
> -    t += 8;
> -  if (x >= HOST_WIDE_INT_1U << (t + 4))
> -    t += 4;
> -  if (x >= HOST_WIDE_INT_1U << (t + 2))
> -    t += 2;
> -  if (x >= HOST_WIDE_INT_1U << (t + 1))
> -    t += 1;
> -
> -  return t;
> -}
> -
> -/* Given X, an unsigned number, return the least Y such that 2**Y >= X.  */
> -
> -int
> -ceil_log2 (unsigned HOST_WIDE_INT x)
> -{
> -  return x == 0 ? 0 : floor_log2 (x - 1) + 1;
> -}
> -
> -/* Return the logarithm of X, base 2, considering X unsigned,
> -   if X is a power of 2.  Otherwise, returns -1.  */
> -
> -int
> -exact_log2 (unsigned HOST_WIDE_INT x)
> -{
> -  if (!pow2p_hwi (x))
> -    return -1;
> -  return floor_log2 (x);
> -}
> -
> -/* Given X, an unsigned number, return the number of least significant bits
> -   that are zero.  When X == 0, the result is the word size.  */
> -
> -int
> -ctz_hwi (unsigned HOST_WIDE_INT x)
> -{
> -  return x ? floor_log2 (least_bit_hwi (x)) : HOST_BITS_PER_WIDE_INT;
> -}
> -
> -/* Similarly for most significant bits.  */
> -
> -int
> -clz_hwi (unsigned HOST_WIDE_INT x)
> -{
> -  return HOST_BITS_PER_WIDE_INT - 1 - floor_log2 (x);
> -}
> -
> -/* Similar to ctz_hwi, except that the least significant bit is numbered
> -   starting from 1, and X == 0 yields 0.  */
> -
> -int
> -ffs_hwi (unsigned HOST_WIDE_INT x)
> -{
> -  return 1 + floor_log2 (least_bit_hwi (x));
> -}
> -
> -/* Return the number of set bits in X.  */
> -
> -int
> -popcount_hwi (unsigned HOST_WIDE_INT x)
> -{
> -  int i, ret = 0;
> -  size_t bits = sizeof (x) * CHAR_BIT;
> -
> -  for (i = 0; i < bits; i += 1)
> -    {
> -      ret += x & 1;
> -      x >>= 1;
> -    }
> -
> -  return ret;
> -}
> -
> -#endif /* GCC_VERSION < 3004 */
> -
> -
>  /* Compute the greatest common divisor of two numbers A and B using
>     Euclid's algorithm.  */
>
> diff --git a/gcc/hwint.h b/gcc/hwint.h
> index c160bea0cb2..f3b5a779a65 100644
> --- a/gcc/hwint.h
> +++ b/gcc/hwint.h
> @@ -28,18 +28,16 @@
>  #define HOST_LONG_LONG_FORMAT "ll"
>  #endif
>
> -/* If HAVE_LONG_LONG and SIZEOF_LONG_LONG aren't defined, but
> -   GCC_VERSION >= 3000, assume this is the second or later stage of a
> +/* If HAVE_LONG_LONG and SIZEOF_LONG_LONG aren't defined
> +   assume this is the second or later stage of a
>     bootstrap, we do have long long, and it's 64 bits.  (This is
>     required by C99; we do have some ports that violate that assumption
>     but they're all cross-compile-only.)  Just in case, force a
>     constraint violation if that assumption is incorrect.  */
>  #if !defined HAVE_LONG_LONG
> -# if GCC_VERSION >= 3000
> -#  define HAVE_LONG_LONG 1
> -#  define SIZEOF_LONG_LONG 8
> +# define HAVE_LONG_LONG 1
> +# define SIZEOF_LONG_LONG 8
>  extern char sizeof_long_long_must_be_8[sizeof (long long) == 8 ? 1 : -1];
> -# endif
>  #endif
>
>  #ifdef HAVE_LONG_LONG
> @@ -160,26 +158,6 @@ pow2p_hwi (unsigned HOST_WIDE_INT x)
>    return x && pow2_or_zerop (x);
>  }
>
> -#if GCC_VERSION < 3004
> -
> -extern int clz_hwi (unsigned HOST_WIDE_INT x);
> -extern int ctz_hwi (unsigned HOST_WIDE_INT x);
> -extern int ffs_hwi (unsigned HOST_WIDE_INT x);
> -
> -/* Return the number of set bits in X.  */
> -extern int popcount_hwi (unsigned HOST_WIDE_INT x);
> -
> -/* Return log2, or -1 if not exact.  */
> -extern int exact_log2                  (unsigned HOST_WIDE_INT);
> -
> -/* Return floor of log2, with -1 for zero.  */
> -extern int floor_log2                  (unsigned HOST_WIDE_INT);
> -
> -/* Return the smallest n such that 2**n >= X.  */
> -extern int ceil_log2                   (unsigned HOST_WIDE_INT);
> -
> -#else /* GCC_VERSION >= 3004 */
> -
>  /* For convenience, define 0 -> word_size.  */
>  static inline int
>  clz_hwi (unsigned HOST_WIDE_INT x)
> @@ -251,8 +229,6 @@ exact_log2 (unsigned HOST_WIDE_INT x)
>    return pow2p_hwi (x) ? ctz_hwi (x) : -1;
>  }
>
> -#endif /* GCC_VERSION >= 3004 */
> -
>  #define HOST_WIDE_INT_MIN (HOST_WIDE_INT) \
>    (HOST_WIDE_INT_1U << (HOST_BITS_PER_WIDE_INT - 1))
>  #define HOST_WIDE_INT_MAX (~(HOST_WIDE_INT_MIN))
> diff --git a/gcc/ira-int.h b/gcc/ira-int.h
> index f42a314fa7f..76ce6b4d75c 100644
> --- a/gcc/ira-int.h
> +++ b/gcc/ira-int.h
> @@ -151,7 +151,7 @@ extern int ira_loop_tree_height;
>  extern ira_loop_tree_node_t ira_bb_nodes;
>
>  /* Two access macros to the nodes representing basic blocks.  */
> -#if defined ENABLE_IRA_CHECKING && (GCC_VERSION >= 2007)
> +#ifdef ENABLE_IRA_CHECKING
>  #define IRA_BB_NODE_BY_INDEX(index) __extension__                      \
>  (({ ira_loop_tree_node_t _node = (&ira_bb_nodes[index]);               \
>       if (_node->children != NULL || _node->loop != NULL || _node->bb == NULL)\
> @@ -173,7 +173,7 @@ extern ira_loop_tree_node_t ira_bb_nodes;
>  extern ira_loop_tree_node_t ira_loop_nodes;
>
>  /* Two access macros to the nodes representing loops.  */
> -#if defined ENABLE_IRA_CHECKING && (GCC_VERSION >= 2007)
> +#ifdef ENABLE_IRA_CHECKING
>  #define IRA_LOOP_NODE_BY_INDEX(index) __extension__                    \
>  (({ ira_loop_tree_node_t const _node = (&ira_loop_nodes[index]);       \
>       if (_node->children == NULL || _node->bb != NULL                  \
> @@ -655,7 +655,7 @@ extern int ira_move_loops_num, ira_additional_jumps_num;
>  /* Set, clear or test bit number I in R, a bit vector of elements with
>     minimal index and maximal index equal correspondingly to MIN and
>     MAX.  */
> -#if defined ENABLE_IRA_CHECKING && (GCC_VERSION >= 2007)
> +#ifdef ENABLE_IRA_CHECKING
>
>  #define SET_MINMAX_SET_BIT(R, I, MIN, MAX) __extension__               \
>    (({ int _min = (MIN), _max = (MAX), _i = (I);                                \
> diff --git a/gcc/jit/jit-common.h b/gcc/jit/jit-common.h
> index 3ff7447fbf3..773a2d8df43 100644
> --- a/gcc/jit/jit-common.h
> +++ b/gcc/jit/jit-common.h
> @@ -29,11 +29,7 @@ along with GCC; see the file COPYING3.  If not see
>  #include "tree-iterator.h"
>
>  #ifdef GCC_VERSION
> -#if GCC_VERSION >= 4001
>  #define GNU_PRINTF(M, N) __attribute__ ((format (gnu_printf, (M), (N))))
> -#else
> -#define GNU_PRINTF(M, N)
> -#endif
>  #endif
>
>  const int NUM_GCC_JIT_TYPES = GCC_JIT_TYPE_INT128_T + 1;
> diff --git a/gcc/machmode.h b/gcc/machmode.h
> index 45df720df73..d84bdd5797d 100644
> --- a/gcc/machmode.h
> +++ b/gcc/machmode.h
> @@ -545,12 +545,8 @@ complex_mode::includes_p (machine_mode m)
>  ALWAYS_INLINE poly_uint16
>  mode_to_bytes (machine_mode mode)
>  {
> -#if GCC_VERSION >= 4001
>    return (__builtin_constant_p (mode)
>           ? mode_size_inline (mode) : mode_size[mode]);
> -#else
> -  return mode_size[mode];
> -#endif
>  }
>
>  /* Return the base GET_MODE_BITSIZE value for MODE.  */
> @@ -574,13 +570,9 @@ mode_to_precision (machine_mode mode)
>  ALWAYS_INLINE scalar_mode
>  mode_to_inner (machine_mode mode)
>  {
> -#if GCC_VERSION >= 4001
>    return scalar_mode::from_int (__builtin_constant_p (mode)
>                                 ? mode_inner_inline (mode)
>                                 : mode_inner[mode]);
> -#else
> -  return scalar_mode::from_int (mode_inner[mode]);
> -#endif
>  }
>
>  /* Return the base GET_MODE_UNIT_SIZE value for MODE.  */
> @@ -588,12 +580,8 @@ mode_to_inner (machine_mode mode)
>  ALWAYS_INLINE unsigned char
>  mode_to_unit_size (machine_mode mode)
>  {
> -#if GCC_VERSION >= 4001
>    return (__builtin_constant_p (mode)
>           ? mode_unit_size_inline (mode) : mode_unit_size[mode]);
> -#else
> -  return mode_unit_size[mode];
> -#endif
>  }
>
>  /* Return the base GET_MODE_UNIT_PRECISION value for MODE.  */
> @@ -601,12 +589,8 @@ mode_to_unit_size (machine_mode mode)
>  ALWAYS_INLINE unsigned short
>  mode_to_unit_precision (machine_mode mode)
>  {
> -#if GCC_VERSION >= 4001
>    return (__builtin_constant_p (mode)
>           ? mode_unit_precision_inline (mode) : mode_unit_precision[mode]);
> -#else
> -  return mode_unit_precision[mode];
> -#endif
>  }
>
>  /* Return the base GET_MODE_NUNITS value for MODE.  */
> @@ -614,12 +598,8 @@ mode_to_unit_precision (machine_mode mode)
>  ALWAYS_INLINE poly_uint16
>  mode_to_nunits (machine_mode mode)
>  {
> -#if GCC_VERSION >= 4001
>    return (__builtin_constant_p (mode)
>           ? mode_nunits_inline (mode) : mode_nunits[mode]);
> -#else
> -  return mode_nunits[mode];
> -#endif
>  }
>
>  /* Get the size in bytes of an object of mode MODE.  */
> diff --git a/gcc/output.h b/gcc/output.h
> index 6dea630913a..2fce8b5c19f 100644
> --- a/gcc/output.h
> +++ b/gcc/output.h
> @@ -115,11 +115,7 @@ extern void output_addr_const (FILE *, rtx);
>
>  /* Output a string of assembler code, substituting numbers, strings
>     and fixed syntactic prefixes.  */
> -#if GCC_VERSION >= 3004
>  #define ATTRIBUTE_ASM_FPRINTF(m, n) __attribute__ ((__format__ (__asm_fprintf__, m, n))) ATTRIBUTE_NONNULL(m)
> -#else
> -#define ATTRIBUTE_ASM_FPRINTF(m, n) ATTRIBUTE_NONNULL(m)
> -#endif
>
>  extern void fprint_whex (FILE *, unsigned HOST_WIDE_INT);
>  extern void fprint_ul (FILE *, unsigned long);
> diff --git a/gcc/pretty-print.h b/gcc/pretty-print.h
> index fc588447460..425ae339ae0 100644
> --- a/gcc/pretty-print.h
> +++ b/gcc/pretty-print.h
> @@ -374,11 +374,7 @@ extern void pp_separate_with (pretty_printer *, char);
>
>  /* This header may be included before diagnostics-core.h, hence the duplicate
>     definitions to allow for GCC-specific formats.  */
> -#if GCC_VERSION >= 3005
>  #define ATTRIBUTE_GCC_PPDIAG(m, n) __attribute__ ((__format__ (GCC_PPDIAG_STYLE, m ,n))) ATTRIBUTE_NONNULL(m)
> -#else
> -#define ATTRIBUTE_GCC_PPDIAG(m, n) ATTRIBUTE_NONNULL(m)
> -#endif
>  extern void pp_printf (pretty_printer *, const char *, ...)
>       ATTRIBUTE_GCC_PPDIAG(2,3);
>
> diff --git a/gcc/rtl.cc b/gcc/rtl.cc
> index 86c322b19ca..74be7342803 100644
> --- a/gcc/rtl.cc
> +++ b/gcc/rtl.cc
> @@ -869,7 +869,7 @@ dump_rtx_statistics (void)
>    fprintf (stderr, "-----------------------------------------------\n");
>  }
>
> -#if defined ENABLE_RTL_CHECKING && (GCC_VERSION >= 2007)
> +#ifdef ENABLE_RTL_CHECKING
>
>  /* Disable warnings about missing quoting in GCC diagnostics for
>     the internal_error calls.  Their format strings deliberately don't
> diff --git a/gcc/rtl.h b/gcc/rtl.h
> index 488016bb42a..5e77be2f024 100644
> --- a/gcc/rtl.h
> +++ b/gcc/rtl.h
> @@ -1076,7 +1076,7 @@ is_a_helper <rtx_note *>::test (rtx_insn *insn)
>
>  /* General accessor macros for accessing the fields of an rtx.  */
>
> -#if defined ENABLE_RTL_CHECKING && (GCC_VERSION >= 2007)
> +#if defined ENABLE_RTL_CHECKING
>  /* The bit with a star outside the statement expr and an & inside is
>     so that N can be evaluated only once.  */
>  #define RTL_CHECK1(RTX, N, C1) __extension__                           \
> @@ -1257,7 +1257,7 @@ extern void rtvec_check_failed_bounds (const_rtvec, int, const char *, int,
>  /* Access an individual rtx flag, with no checking of any kind.  */
>  #define RTX_FLAG(RTX, FLAG)    ((RTX)->FLAG)
>
> -#if defined ENABLE_RTL_FLAG_CHECKING && (GCC_VERSION >= 2007)
> +#if defined ENABLE_RTL_FLAG_CHECKING
>  #define RTL_FLAG_CHECK1(NAME, RTX, C1) __extension__                   \
>  ({ __typeof (RTX) const _rtx = (RTX);                                  \
>     if (GET_CODE (_rtx) != C1)                                          \
> @@ -1823,7 +1823,7 @@ enum label_kind
>    LABEL_WEAK_ENTRY     /* alternate entry point, exported as weak symbol */
>  };
>
> -#if defined ENABLE_RTL_FLAG_CHECKING && (GCC_VERSION > 2007)
> +#if defined ENABLE_RTL_FLAG_CHECKING
>
>  /* Retrieve the kind of LABEL.  */
>  #define LABEL_KIND(LABEL) __extension__                                        \
> diff --git a/gcc/sbitmap.cc b/gcc/sbitmap.cc
> index 5ac2b6d0f67..0a6fddadab8 100644
> --- a/gcc/sbitmap.cc
> +++ b/gcc/sbitmap.cc
> @@ -375,33 +375,6 @@ bitmap_bit_in_range_p (const_sbitmap bmap, unsigned int start, unsigned int end)
>    return (bmap->elms[start_word] & mask) != 0;
>  }
>
> -#if GCC_VERSION < 3400
> -/* Table of number of set bits in a character, indexed by value of char.  */
> -static const unsigned char popcount_table[] =
> -{
> -    0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,
> -    1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
> -    1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
> -    2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
> -    1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
> -    2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
> -    2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
> -    3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,4,5,5,6,5,6,6,7,5,6,6,7,6,7,7,8,
> -};
> -
> -static unsigned long
> -sbitmap_popcount (SBITMAP_ELT_TYPE a)
> -{
> -  unsigned long ret = 0;
> -  unsigned i;
> -
> -  /* Just do this the table way for now  */
> -  for (i = 0; i < HOST_BITS_PER_WIDEST_FAST_INT; i += 8)
> -    ret += popcount_table[(a >> i) & 0xff];
> -  return ret;
> -}
> -#endif
> -
>  /* Count and return the number of bits set in the bitmap BMAP.  */
>
>  unsigned int
> @@ -411,16 +384,12 @@ bitmap_count_bits (const_sbitmap bmap)
>    for (unsigned int i = 0; i < bmap->size; i++)
>      if (bmap->elms[i])
>        {
> -#if GCC_VERSION < 3400
> -       count += sbitmap_popcount (bmap->elms[i]);
> -#else
> -# if HOST_BITS_PER_WIDEST_FAST_INT == HOST_BITS_PER_LONG
> +#if HOST_BITS_PER_WIDEST_FAST_INT == HOST_BITS_PER_LONG
>         count += __builtin_popcountl (bmap->elms[i]);
> -# elif HOST_BITS_PER_WIDEST_FAST_INT == HOST_BITS_PER_LONGLONG
> +#elif HOST_BITS_PER_WIDEST_FAST_INT == HOST_BITS_PER_LONGLONG
>         count += __builtin_popcountll (bmap->elms[i]);
> -# else
> +#else
>         count += __builtin_popcount (bmap->elms[i]);
> -# endif
>  #endif
>        }
>    return count;
> diff --git a/gcc/stringpool.h b/gcc/stringpool.h
> index 5e301c6011b..b43110cc7a0 100644
> --- a/gcc/stringpool.h
> +++ b/gcc/stringpool.h
> @@ -33,11 +33,9 @@ extern tree maybe_get_identifier (const char *);
>     known.  */
>  extern tree get_identifier_with_length (const char *, size_t);
>
> -#if GCC_VERSION >= 3000
>  #define get_identifier(str) \
>    (__builtin_constant_p (str)                          \
>      ? get_identifier_with_length ((str), strlen (str))  \
>      : get_identifier (str))
> -#endif
>
>  #endif  // GCC_STRINGPOOL_H
> diff --git a/gcc/system.h b/gcc/system.h
> index c5562cc49a3..1688b763ef5 100644
> --- a/gcc/system.h
> +++ b/gcc/system.h
> @@ -596,17 +596,15 @@ extern int vsnprintf (char *, size_t, const char *, va_list);
>  #ifdef __cplusplus
>  #define HAVE_DESIGNATED_INITIALIZERS 0
>  #else
> -#define HAVE_DESIGNATED_INITIALIZERS \
> -  ((GCC_VERSION >= 2007) || (__STDC_VERSION__ >= 199901L))
> +#define HAVE_DESIGNATED_INITIALIZERS 1
>  #endif
>  #endif
>
>  #if !defined(HAVE_DESIGNATED_UNION_INITIALIZERS)
>  #ifdef __cplusplus
> -#define HAVE_DESIGNATED_UNION_INITIALIZERS (GCC_VERSION >= 4007)
> +#define HAVE_DESIGNATED_UNION_INITIALIZERS 1
>  #else
> -#define HAVE_DESIGNATED_UNION_INITIALIZERS \
> -  ((GCC_VERSION >= 2007) || (__STDC_VERSION__ >= 199901L))
> +#define HAVE_DESIGNATED_UNION_INITIALIZERS 1
>  #endif
>  #endif
>
> @@ -722,20 +720,6 @@ extern int vsnprintf (char *, size_t, const char *, va_list);
>  #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *) 0)->MEMBER)
>  #endif
>
> -/* Various error reporting routines want to use __FUNCTION__.  */
> -#if (GCC_VERSION < 2007)
> -#ifndef __FUNCTION__
> -#define __FUNCTION__ "?"
> -#endif /* ! __FUNCTION__ */
> -#endif
> -
> -/* __builtin_expect(A, B) evaluates to A, but notifies the compiler that
> -   the most likely value of A is B.  This feature was added at some point
> -   between 2.95 and 3.0.  Let's use 3.0 as the lower bound for now.  */
> -#if (GCC_VERSION < 3000)
> -#define __builtin_expect(a, b) (a)
> -#endif
> -
>  /* Some of the headers included by <memory> can use "abort" within a
>     namespace, e.g. "_VSTD::abort();", which fails after we use the
>     preprocessor to redefine "abort" as "fancy_abort" below.  */
> @@ -781,12 +765,9 @@ extern void fancy_abort (const char *, int, const char *)
>  #if ENABLE_ASSERT_CHECKING
>  #define gcc_assert(EXPR)                                               \
>     ((void)(!(EXPR) ? fancy_abort (__FILE__, __LINE__, __FUNCTION__), 0 : 0))
> -#elif (GCC_VERSION >= 4005)
> +#else
>  #define gcc_assert(EXPR)                                               \
>    ((void)(__builtin_expect (!(EXPR), 0) ? __builtin_unreachable (), 0 : 0))
> -#else
> -/* Include EXPR, so that unused variable warnings do not occur.  */
> -#define gcc_assert(EXPR) ((void)(0 && (EXPR)))
>  #endif
>
>  #if CHECKING_P
> @@ -796,21 +777,13 @@ extern void fancy_abort (const char *, int, const char *)
>  #define gcc_checking_assert(EXPR) ((void)(0 && (EXPR)))
>  #endif
>
> -#if GCC_VERSION >= 4000
>  #define ALWAYS_INLINE inline __attribute__ ((always_inline))
> -#else
> -#define ALWAYS_INLINE inline
> -#endif
>
> -#if GCC_VERSION >= 3004
>  #define WARN_UNUSED_RESULT __attribute__ ((__warn_unused_result__))
> -#else
> -#define WARN_UNUSED_RESULT
> -#endif
>
>  /* Use gcc_unreachable() to mark unreachable locations (like an
>     unreachable default case of a switch.  Do not use gcc_assert(0).  */
> -#if (GCC_VERSION >= 4005) && !ENABLE_ASSERT_CHECKING
> +#if !ENABLE_ASSERT_CHECKING
>  #define gcc_unreachable() __builtin_unreachable ()
>  #else
>  #define gcc_unreachable() (fancy_abort (__FILE__, __LINE__, __FUNCTION__))
> @@ -826,11 +799,7 @@ extern void fancy_abort (const char *, int, const char *)
>  # define gcc_fallthrough()
>  #endif
>
> -#if GCC_VERSION >= 3001
>  #define STATIC_CONSTANT_P(X) (__builtin_constant_p (X) && (X))
> -#else
> -#define STATIC_CONSTANT_P(X) (false && (X))
> -#endif
>
>  /* static_assert (COND, MESSAGE) is available in C++11 onwards.  */
>  #if __cplusplus >= 201103L
> @@ -871,12 +840,6 @@ extern void fancy_abort (const char *, int, const char *)
>  /* Some compilers do not allow the use of unsigned char in bitfields.  */
>  #define BOOL_BITFIELD unsigned int
>
> -/* GCC older than 4.4 have broken C++ value initialization handling, see
> -   PR11309, PR30111, PR33916, PR82939 and PR84405 for more details.  */
> -#if GCC_VERSION > 0 && GCC_VERSION < 4004 && !defined(__clang__)
> -# define BROKEN_VALUE_INITIALIZATION
> -#endif
> -
>  /* As the last action in this file, we poison the identifiers that
>     shouldn't be used.  Note, luckily gcc-3.0's token-based integrated
>     preprocessor won't trip on poisoned identifiers that arrive from
> @@ -899,8 +862,6 @@ extern void fancy_abort (const char *, int, const char *)
>  #define realloc xrealloc
>  #endif
>
> -#if (GCC_VERSION >= 3000)
> -
>  /* Note autoconf checks for prototype declarations and includes
>     system.h while doing so.  Only poison these tokens if actually
>     compiling gcc, so that the autoconf declaration tests for malloc
> @@ -1130,8 +1091,6 @@ extern void fancy_abort (const char *, int, const char *)
>     'if (flag_checking)', or with CHECKING_P macro.  */
>  #pragma GCC poison ENABLE_CHECKING
>
> -#endif /* GCC >= 3.0 */
> -
>  /* This macro allows casting away const-ness to pass -Wcast-qual
>     warnings.  DO NOT USE THIS UNLESS YOU REALLY HAVE TO!  It should
>     only be used in certain specific cases.  One valid case is where
> @@ -1151,7 +1110,7 @@ extern void fancy_abort (const char *, int, const char *)
>  #ifdef __cplusplus
>  #define CONST_CAST2(TOTYPE,FROMTYPE,X) (const_cast<TOTYPE> (X))
>  #else
> -#if defined(__GNUC__) && GCC_VERSION > 4000
> +#ifdef __GNUC__
>  /* GCC 4.0.x has a bug where it may ICE on this expression,
>     so does GCC 3.4.x (PR17436).  */
>  #define CONST_CAST2(TOTYPE,FROMTYPE,X) ((__extension__(union {FROMTYPE _q; TOTYPE _nq;})(X))._nq)
> @@ -1182,13 +1141,9 @@ helper_const_non_const_cast (const char *p)
>
>  /* Activate certain diagnostics as warnings (not errors via the
>     -Werror flag).  */
> -#if GCC_VERSION >= 4003
> -/* If asserts are disabled, activate -Wuninitialized as a warning (not
> -   an error/-Werror).  */
>  #ifndef ENABLE_ASSERT_CHECKING
>  #pragma GCC diagnostic warning "-Wuninitialized"
>  #endif
> -#endif
>
>  #ifdef ENABLE_VALGRIND_ANNOTATIONS
>  # ifdef HAVE_VALGRIND_MEMCHECK_H
> @@ -1229,13 +1184,8 @@ helper_const_non_const_cast (const char *p)
>
>  /* In LTO -fwhole-program build we still want to keep the debug functions available
>     for debugger.  Mark them as used to prevent removal.  */
> -#if (GCC_VERSION > 4000)
>  #define DEBUG_FUNCTION __attribute__ ((__used__))
>  #define DEBUG_VARIABLE __attribute__ ((__used__))
> -#else
> -#define DEBUG_FUNCTION
> -#define DEBUG_VARIABLE
> -#endif
>
>  /* General macro to extract bit Y of X.  */
>  #define TEST_BIT(X, Y) (((X) >> (Y)) & 1)
> diff --git a/gcc/tree-vrp.cc b/gcc/tree-vrp.cc
> index 0cbd9d369ca..436fafcaa0f 100644
> --- a/gcc/tree-vrp.cc
> +++ b/gcc/tree-vrp.cc
> @@ -2955,12 +2955,7 @@ vrp_asserts::find_switch_asserts (basic_block bb, gswitch *last)
>    edge e;
>    struct case_info *ci;
>    size_t n = gimple_switch_num_labels (last);
> -#if GCC_VERSION >= 4000
>    unsigned int idx;
> -#else
> -  /* Work around GCC 3.4 bug (PR 37086).  */
> -  volatile unsigned int idx;
> -#endif
>
>    bsi = gsi_for_stmt (last);
>    op = gimple_switch_index (last);
> diff --git a/gcc/tree.cc b/gcc/tree.cc
> index 5e8876d2b38..22df459c53e 100644
> --- a/gcc/tree.cc
> +++ b/gcc/tree.cc
> @@ -8771,7 +8771,7 @@ get_file_function_name (const char *type)
>    return get_identifier (buf);
>  }
>
> -#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
> +#ifdef ENABLE_TREE_CHECKING
>
>  /* Complain that the tree code of NODE does not match the expected 0
>     terminated list of trailing codes. The trailing code list can be
> diff --git a/gcc/tree.h b/gcc/tree.h
> index 82eb8ba39d2..c53d34f6a47 100644
> --- a/gcc/tree.h
> +++ b/gcc/tree.h
> @@ -246,7 +246,7 @@ as_internal_fn (combined_fn code)
>
>  /* When checking is enabled, errors will be generated if a tree node
>     is accessed incorrectly. The macros die with a fatal error.  */
> -#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
> +#ifdef ENABLE_TREE_CHECKING
>
>  #define TREE_CHECK(T, CODE) \
>  (tree_check ((T), __FILE__, __LINE__, __FUNCTION__, (CODE)))
> @@ -2831,16 +2831,12 @@ extern void decl_value_expr_insert (tree, tree);
>  /* The DECL_RTL for NODE, if it is set, or NULL, if it is not set.  */
>  #define DECL_RTL_IF_SET(NODE) (DECL_RTL_SET_P (NODE) ? DECL_RTL (NODE) : NULL)
>
> -#if (GCC_VERSION >= 2007)
>  #define DECL_RTL_KNOWN_SET(decl) __extension__                         \
>  ({  tree const __d = (decl);                                           \
>      gcc_checking_assert (DECL_RTL_SET_P (__d));                                \
>      /* Dereference it so the compiler knows it can't be NULL even      \
>         without assertion checking.  */                                 \
>      &*DECL_RTL_IF_SET (__d); })
> -#else
> -#define DECL_RTL_KNOWN_SET(decl) (&*DECL_RTL_IF_SET (decl))
> -#endif
>
>  /* In VAR_DECL and PARM_DECL nodes, nonzero means declared `register'.  */
>  #define DECL_REGISTER(NODE) (DECL_WRTL_CHECK (NODE)->decl_common.decl_flag_0)
> @@ -3448,7 +3444,7 @@ extern tree build_target_option_node (struct gcc_options *opts,
>
>  extern void prepare_target_option_nodes_for_pch (void);
>
> -#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
> +#ifdef ENABLE_TREE_CHECKING
>
>  inline tree
>  tree_check (tree __t, const char *__f, int __l, const char *__g, tree_code __c)
> @@ -3663,10 +3659,8 @@ tree_int_cst_elt_check (tree __t, int __i,
>
>  /* Workaround -Wstrict-overflow false positive during profiledbootstrap.  */
>
> -# if GCC_VERSION >= 4006
>  #pragma GCC diagnostic push
>  #pragma GCC diagnostic ignored "-Wstrict-overflow"
> -#endif
>
>  inline tree *
>  tree_vec_elt_check (tree __t, int __i,
> @@ -3679,9 +3673,7 @@ tree_vec_elt_check (tree __t, int __i,
>    return &CONST_CAST_TREE (__t)->vec.a[__i];
>  }
>
> -# if GCC_VERSION >= 4006
>  #pragma GCC diagnostic pop
> -#endif
>
>  inline tree *
>  omp_clause_elt_check (tree __t, int __i,
> @@ -3889,10 +3881,8 @@ non_type_check (const_tree __t, const char *__f, int __l, const char *__g)
>    return __t;
>  }
>
> -# if GCC_VERSION >= 4006
>  #pragma GCC diagnostic push
>  #pragma GCC diagnostic ignored "-Wstrict-overflow"
> -#endif
>
>  inline const_tree *
>  tree_vec_elt_check (const_tree __t, int __i,
> @@ -3906,9 +3896,7 @@ tree_vec_elt_check (const_tree __t, int __i,
>    //return &__t->vec.a[__i];
>  }
>
> -# if GCC_VERSION >= 4006
>  #pragma GCC diagnostic pop
> -#endif
>
>  inline const_tree *
>  omp_clause_elt_check (const_tree __t, int __i,
> @@ -3945,7 +3933,7 @@ tree_operand_length (const_tree node)
>      return TREE_CODE_LENGTH (TREE_CODE (node));
>  }
>
> -#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
> +#ifdef ENABLE_TREE_CHECKING
>
>  /* Special checks for TREE_OPERANDs.  */
>  inline tree *
> @@ -4679,7 +4667,7 @@ extern unsigned HOST_WIDE_INT tree_to_uhwi (const_tree)
>    ATTRIBUTE_NONNULL (1) ATTRIBUTE_PURE;
>  extern poly_uint64 tree_to_poly_uint64 (const_tree)
>    ATTRIBUTE_NONNULL (1) ATTRIBUTE_PURE;
> -#if !defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 4003)
> +#ifndef ENABLE_TREE_CHECKING
>  extern inline __attribute__ ((__gnu_inline__)) HOST_WIDE_INT
>  tree_to_shwi (const_tree t)
>  {
> diff --git a/gcc/var-tracking.cc b/gcc/var-tracking.cc
> index 7c3ad0a55bd..2a3a0684e97 100644
> --- a/gcc/var-tracking.cc
> +++ b/gcc/var-tracking.cc
> @@ -404,7 +404,7 @@ int_mem_offset (const_rtx mem)
>    return 0;
>  }
>
> -#if CHECKING_P && (GCC_VERSION >= 2007)
> +#if CHECKING_P
>
>  /* Access VAR's Ith part's offset, checking that it's not a one-part
>     variable.  */
> diff --git a/gcc/vec.h b/gcc/vec.h
> index 3ba7ea7edc2..3cb2772301c 100644
> --- a/gcc/vec.h
> +++ b/gcc/vec.h
> @@ -295,10 +295,8 @@ va_heap::reserve (vec<T, va_heap, vl_embed> *&v, unsigned reserve, bool exact
>  }
>
>
> -#if GCC_VERSION >= 4007
>  #pragma GCC diagnostic push
>  #pragma GCC diagnostic ignored "-Wfree-nonheap-object"
> -#endif
>
>  /* Free the heap space allocated for vector V.  */
>
> @@ -317,9 +315,7 @@ va_heap::release (vec<T, va_heap, vl_embed> *&v)
>    v = NULL;
>  }
>
> -#if GCC_VERSION >= 4007
>  #pragma GCC diagnostic pop
> -#endif
>
>  /* Allocator type for GC vectors.  Notice that we need the structure
>     declaration even if GC is not enabled.  */
> @@ -2349,8 +2345,6 @@ make_array_slice (T *base, unsigned int size)
>    return array_slice<T> (base, size);
>  }
>
> -#if (GCC_VERSION >= 3000)
> -# pragma GCC poison m_vec m_vecpfx m_vecdata
> -#endif
> +#pragma GCC poison m_vec m_vecpfx m_vecdata
>
>  #endif // GCC_VEC_H
> diff --git a/gcc/wide-int.cc b/gcc/wide-int.cc
> index f61b9fefc13..ffd96e6b9d9 100644
> --- a/gcc/wide-int.cc
> +++ b/gcc/wide-int.cc
> @@ -37,7 +37,7 @@ along with GCC; see the file COPYING3.  If not see
>
>  #define W_TYPE_SIZE HOST_BITS_PER_WIDE_INT
>  /* Do not include longlong.h when compiler is clang-based. See PR61146.  */
> -#if GCC_VERSION >= 3000 && (W_TYPE_SIZE == 32 || defined (__SIZEOF_INT128__)) && !defined(__clang__)
> +#if (W_TYPE_SIZE == 32 || defined (__SIZEOF_INT128__)) && !defined(__clang__)
>  typedef unsigned HOST_HALF_WIDE_INT UHWtype;
>  typedef unsigned HOST_WIDE_INT UWtype;
>  typedef unsigned int UQItype __attribute__ ((mode (QI)));
> --
> 2.36.0
>
  
Martin Liška May 5, 2022, 6:25 p.m. UTC | #2
On 5/5/22 14:24, Richard Biener wrote:
> Hmm, but we support C++11 host compilers that are not GCC but
> may claim to be, with GCC_VERSION 4.2.x for example.  Are we sure
> all those liars implement what we guard with the version checks?

Do you know about any real example of such a liars?
Why should we even care about them?

Martin

> 
> I suppose to be "correct" we'd at least need to preserve
> #if __GNUC__
> in places where we might use the host compiler?  (if compilers then lie
> it's their own fault)
  
Andrew Pinski May 5, 2022, 6:35 p.m. UTC | #3
On Thu, May 5, 2022 at 5:19 AM Martin Liška <mliska@suse.cz> wrote:
>
> Right now, the minimal required version of GCC is 4.8.x
> that is a version that well supports c++11.
>
> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>
> Ready to be installed?

No. This is broken as GCC_VERSION is used for two things. First it is
used to say which GCC version it is being compiled with and second it
also says if GCC is being used.
GCC_VERSION will be 0 if GCC is not being used.
So you need to audit these better really.

Thanks,
Andrew Pinski

> Thanks,
> Martin
>
> gcc/ChangeLog:
>
>         * bitmap.cc (bitmap_popcount):
>         Fold GCC_VERSION >= $old_version to TRUE, otherwise to FALSE.
>         (bitmap_count_bits_in_word): Likewise.
>         (bitmap_single_bit_set_p): Likewise.
>         (bitmap_first_set_bit): Likewise.
>         (bitmap_last_set_bit): Likewise.
>         * bitmap.h (if): Likewise.
>         * config/ia64/ia64.cc (RWS_FIELD_TYPE): Likewise.
>         * config/rs6000/rs6000.h (if): Likewise.
>         * defaults.h: Likewise.
>         * diagnostic-core.h (if): Likewise.
>         (ATTRIBUTE_GCC_DIAG): Likewise.
>         * dwarf2cfi.cc (if): Likewise.
>         * dwarf2out.cc (if): Likewise.
>         (DWARF2_ASM_LINE_DEBUG_INFO): Likewise.
>         (DWARF2_ASM_VIEW_DEBUG_INFO): Likewise.
>         * gcc.cc (if): Likewise.
>         * genautomata.cc (struct state_ainsn_table): Likewise.
>         (regexp_mode_check_failed): Likewise.
>         (REGEXP_ONEOF): Likewise.
>         * genconditions.cc (write_header): Likewise.
>         (write_writer): Likewise.
>         * genmatch.cc: Likewise.
>         * genmodes.cc (GCC_INSN_MODES_INLINE_H): Likewise.
>         * genoutput.cc (output_insn_data): Likewise.
>         * ggc-page.cc (if): Likewise.
>         (prefetch): Likewise.
>         (ggc_internal_alloc): Likewise.
>         * ggc-tests.cc (test_finalization): Likewise.
>         * ggc.h (need_finalization_p): Likewise.
>         * hwint.cc (floor_log2): Likewise.
>         (ceil_log2): Likewise.
>         (exact_log2): Likewise.
>         (ctz_hwi): Likewise.
>         (clz_hwi): Likewise.
>         (ffs_hwi): Likewise.
>         (popcount_hwi): Likewise.
>         * hwint.h (HAVE_LONG_LONG): Likewise.
>         (SIZEOF_LONG_LONG): Likewise.
>         (sizeof_long_long_must_be_8[sizeof): Likewise.
>         (clz_hwi): Likewise.
>         (ctz_hwi): Likewise.
>         (ffs_hwi): Likewise.
>         (popcount_hwi): Likewise.
>         (exact_log2): Likewise.
>         (floor_log2): Likewise.
>         (ceil_log2): Likewise.
>         * ira-int.h: Likewise.
>         * machmode.h (mode_to_bytes): Likewise.
>         (mode_to_inner): Likewise.
>         (mode_to_unit_size): Likewise.
>         (mode_to_unit_precision): Likewise.
>         (mode_to_nunits): Likewise.
>         * output.h (ATTRIBUTE_ASM_FPRINTF): Likewise.
>         * pretty-print.h (ATTRIBUTE_GCC_PPDIAG): Likewise.
>         * rtl.cc (dump_rtx_statistics): Likewise.
>         * rtl.h (test): Likewise.
>         (RTX_FLAG): Likewise.
>         (enum label_kind): Likewise.
>         * sbitmap.cc (sbitmap_popcount): Likewise.
>         (bitmap_count_bits): Likewise.
>         * stringpool.h (get_identifier_with_length): Likewise.
>         * system.h (HAVE_DESIGNATED_INITIALIZERS): Likewise.
>         (HAVE_DESIGNATED_UNION_INITIALIZERS): Likewise.
>         (if): Likewise.
>         (__FUNCTION__): Likewise.
>         (__builtin_expect): Likewise.
>         (elif): Likewise.
>         (gcc_assert): Likewise.
>         (ALWAYS_INLINE): Likewise.
>         (WARN_UNUSED_RESULT): Likewise.
>         (STATIC_CONSTANT_P): Likewise.
>         (defined): Likewise.
>         (BROKEN_VALUE_INITIALIZATION): Likewise.
>         (DEBUG_FUNCTION): Likewise.
>         (DEBUG_VARIABLE): Likewise.
>         * tree-vrp.cc (vrp_asserts::find_switch_asserts): Likewise.
>         * tree.cc (get_file_function_name): Likewise.
>         * tree.h (as_internal_fn): Likewise.
>         (if): Likewise.
>         (DECL_RTL_KNOWN_SET): Likewise.
>         (prepare_target_option_nodes_for_pch): Likewise.
>         (tree_operand_length): Likewise.
>         (tree_to_poly_uint64): Likewise.
>         * var-tracking.cc (int_mem_offset): Likewise.
>         * vec.h (if): Likewise.
>         * wide-int.cc (defined): Likewise.
>         (if): Likewise.
>
> gcc/cp/ChangeLog:
>
>         * cp-tree.h (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK):
>         Fold GCC_VERSION >= $old_version to TRUE, otherwise to FALSE.
>         (STRIP_TEMPLATE): Likewise.
>         * tree.cc (cp_tree_c_finish_parsing): Likewise.
>
> gcc/fortran/ChangeLog:
>
>         * gfortran.h (ATTRIBUTE_GCC_GFC):
>         Fold GCC_VERSION >= $old_version to TRUE, otherwise to FALSE.
>
> gcc/jit/ChangeLog:
>
>         * jit-common.h (GNU_PRINTF):
>         Fold GCC_VERSION >= $old_version to TRUE, otherwise to FALSE.
> ---
>  gcc/bitmap.cc              |  73 +-------------------------
>  gcc/bitmap.h               |  18 ++-----
>  gcc/config/ia64/ia64.cc    |   5 +-
>  gcc/config/rs6000/rs6000.h |   2 -
>  gcc/cp/cp-tree.h           |   4 +-
>  gcc/cp/tree.cc             |   2 +-
>  gcc/defaults.h             |   2 +-
>  gcc/diagnostic-core.h      |   4 --
>  gcc/dwarf2cfi.cc           |   4 +-
>  gcc/dwarf2out.cc           |  16 ++----
>  gcc/fortran/gfortran.h     |   4 --
>  gcc/gcc.cc                 |   2 -
>  gcc/genautomata.cc         |   6 +--
>  gcc/genconditions.cc       |   9 +---
>  gcc/genmatch.cc            |  12 -----
>  gcc/genmodes.cc            |   4 +-
>  gcc/genoutput.cc           |   2 +-
>  gcc/ggc-page.cc            |   9 ----
>  gcc/ggc-tests.cc           |   2 -
>  gcc/ggc.h                  |   4 --
>  gcc/hwint.cc               | 104 -------------------------------------
>  gcc/hwint.h                |  32 ++----------
>  gcc/ira-int.h              |   6 +--
>  gcc/jit/jit-common.h       |   4 --
>  gcc/machmode.h             |  20 -------
>  gcc/output.h               |   4 --
>  gcc/pretty-print.h         |   4 --
>  gcc/rtl.cc                 |   2 +-
>  gcc/rtl.h                  |   6 +--
>  gcc/sbitmap.cc             |  37 ++-----------
>  gcc/stringpool.h           |   2 -
>  gcc/system.h               |  62 +++-------------------
>  gcc/tree-vrp.cc            |   5 --
>  gcc/tree.cc                |   2 +-
>  gcc/tree.h                 |  20 ++-----
>  gcc/var-tracking.cc        |   2 +-
>  gcc/vec.h                  |   8 +--
>  gcc/wide-int.cc            |   2 +-
>  38 files changed, 52 insertions(+), 454 deletions(-)
>
> diff --git a/gcc/bitmap.cc b/gcc/bitmap.cc
> index 88c329f9325..a19d8cddea5 100644
> --- a/gcc/bitmap.cc
> +++ b/gcc/bitmap.cc
> @@ -1081,33 +1081,6 @@ bitmap_get_aligned_chunk (const_bitmap head, unsigned int chunk,
>    return (ptr->bits[word_num] >> bit_num) & max_value;
>  }
>
> -#if GCC_VERSION < 3400
> -/* Table of number of set bits in a character, indexed by value of char.  */
> -static const unsigned char popcount_table[] =
> -{
> -    0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,
> -    1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
> -    1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
> -    2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
> -    1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
> -    2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
> -    2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
> -    3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,4,5,5,6,5,6,6,7,5,6,6,7,6,7,7,8,
> -};
> -
> -static unsigned long
> -bitmap_popcount (BITMAP_WORD a)
> -{
> -  unsigned long ret = 0;
> -  unsigned i;
> -
> -  /* Just do this the table way for now  */
> -  for (i = 0; i < BITMAP_WORD_BITS; i+= 8)
> -    ret += popcount_table[(a >> i) & 0xff];
> -  return ret;
> -}
> -#endif
> -
>  /* Count and return the number of bits set in the bitmap word BITS.  */
>  static unsigned long
>  bitmap_count_bits_in_word (const BITMAP_WORD *bits)
> @@ -1116,13 +1089,9 @@ bitmap_count_bits_in_word (const BITMAP_WORD *bits)
>
>    for (unsigned ix = 0; ix != BITMAP_ELEMENT_WORDS; ix++)
>      {
> -#if GCC_VERSION >= 3400
>        /* Note that popcountl matches BITMAP_WORD in type, so the actual size
>          of BITMAP_WORD is not material.  */
>        count += __builtin_popcountl (bits[ix]);
> -#else
> -      count += bitmap_popcount (bits[ix]);
> -#endif
>      }
>    return count;
>  }
> @@ -1201,13 +1170,9 @@ bitmap_single_bit_set_p (const_bitmap a)
>
>    for (ix = 0; ix != BITMAP_ELEMENT_WORDS; ix++)
>      {
> -#if GCC_VERSION >= 3400
>        /* Note that popcountl matches BITMAP_WORD in type, so the actual size
>          of BITMAP_WORD is not material.  */
>        count += __builtin_popcountl (elt->bits[ix]);
> -#else
> -      count += bitmap_popcount (elt->bits[ix]);
> -#endif
>        if (count > 1)
>         return false;
>      }
> @@ -1244,31 +1209,9 @@ bitmap_first_set_bit (const_bitmap a)
>   found_bit:
>    bit_no += ix * BITMAP_WORD_BITS;
>
> -#if GCC_VERSION >= 3004
>    gcc_assert (sizeof (long) == sizeof (word));
>    bit_no += __builtin_ctzl (word);
> -#else
> -  /* Binary search for the first set bit.  */
> -#if BITMAP_WORD_BITS > 64
> -#error "Fill out the table."
> -#endif
> -#if BITMAP_WORD_BITS > 32
> -  if (!(word & 0xffffffff))
> -    word >>= 32, bit_no += 32;
> -#endif
> -  if (!(word & 0xffff))
> -    word >>= 16, bit_no += 16;
> -  if (!(word & 0xff))
> -    word >>= 8, bit_no += 8;
> -  if (!(word & 0xf))
> -    word >>= 4, bit_no += 4;
> -  if (!(word & 0x3))
> -    word >>= 2, bit_no += 2;
> -  if (!(word & 0x1))
> -    word >>= 1, bit_no += 1;
> -
> - gcc_checking_assert (word & 1);
> -#endif
> +
>   return bit_no;
>  }
>
> @@ -1302,22 +1245,8 @@ bitmap_last_set_bit (const_bitmap a)
>    gcc_assert (elt->bits[ix] != 0);
>   found_bit:
>    bit_no += ix * BITMAP_WORD_BITS;
> -#if GCC_VERSION >= 3004
>    gcc_assert (sizeof (long) == sizeof (word));
>    bit_no += BITMAP_WORD_BITS - __builtin_clzl (word) - 1;
> -#else
> -  /* Hopefully this is a twos-complement host...  */
> -  BITMAP_WORD x = word;
> -  x |= (x >> 1);
> -  x |= (x >> 2);
> -  x |= (x >> 4);
> -  x |= (x >> 8);
> -  x |= (x >> 16);
> -#if BITMAP_WORD_BITS > 32
> -  x |= (x >> 32);
> -#endif
> -  bit_no += bitmap_popcount (x) - 1;
> -#endif
>
>    return bit_no;
>  }
> diff --git a/gcc/bitmap.h b/gcc/bitmap.h
> index 7fba443aff1..e7bf67a5474 100644
> --- a/gcc/bitmap.h
> +++ b/gcc/bitmap.h
> @@ -708,20 +708,10 @@ bmp_iter_next (bitmap_iterator *bi, unsigned *bit_no)
>  static inline void
>  bmp_iter_next_bit (bitmap_iterator * bi, unsigned *bit_no)
>  {
> -#if (GCC_VERSION >= 3004)
> -  {
> -    unsigned int n = __builtin_ctzl (bi->bits);
> -    gcc_assert (sizeof (unsigned long) == sizeof (BITMAP_WORD));
> -    bi->bits >>= n;
> -    *bit_no += n;
> -  }
> -#else
> -  while (!(bi->bits & 1))
> -    {
> -      bi->bits >>= 1;
> -      *bit_no += 1;
> -    }
> -#endif
> +  unsigned int n = __builtin_ctzl (bi->bits);
> +  gcc_assert (sizeof (unsigned long) == sizeof (BITMAP_WORD));
> +  bi->bits >>= n;
> +  *bit_no += n;
>  }
>
>  /* Advance to the next nonzero bit of a single bitmap, we will have
> diff --git a/gcc/config/ia64/ia64.cc b/gcc/config/ia64/ia64.cc
> index f9fb681a36c..445a391f0f8 100644
> --- a/gcc/config/ia64/ia64.cc
> +++ b/gcc/config/ia64/ia64.cc
> @@ -6213,11 +6213,8 @@ ia64_safe_type (rtx_insn *insn)
>     If a predicate register is written by an AND.ORCM we set WRITTEN_BY_AND
>     to true; if it was written by an OR.ANDCM we set WRITTEN_BY_OR to true.  */
>
> -#if GCC_VERSION >= 4000
>  #define RWS_FIELD_TYPE __extension__ unsigned short
> -#else
> -#define RWS_FIELD_TYPE unsigned int
> -#endif
> +
>  struct reg_write_state
>  {
>    RWS_FIELD_TYPE write_count : 2;
> diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h
> index 523256a5c9d..4e83372a291 100644
> --- a/gcc/config/rs6000/rs6000.h
> +++ b/gcc/config/rs6000/rs6000.h
> @@ -2586,9 +2586,7 @@ typedef struct GTY(()) machine_function
>
>  #define TARGET_SUPPORTS_WIDE_INT 1
>
> -#if (GCC_VERSION >= 3000)
>  #pragma GCC poison TARGET_FLOAT128 OPTION_MASK_FLOAT128 MASK_FLOAT128
> -#endif
>
>  /* Whether a given VALUE is a valid 16 or 34-bit signed integer.  */
>  #define SIGNED_INTEGER_NBIT_P(VALUE, N)                                        \
> diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
> index 663fe7a20fc..e9c3cf2bad0 100644
> --- a/gcc/cp/cp-tree.h
> +++ b/gcc/cp/cp-tree.h
> @@ -631,7 +631,7 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX];
>  #define BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK(NODE) \
>    TREE_CHECK(NODE,BOUND_TEMPLATE_TEMPLATE_PARM)
>
> -#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
> +#if defined ENABLE_TREE_CHECKING
>
>  /* Returns t iff the node can have a TEMPLATE_INFO field.  */
>
> @@ -2989,7 +2989,7 @@ struct GTY(()) lang_decl {
>  #define STRIP_TEMPLATE(NODE) \
>    (TREE_CODE (NODE) == TEMPLATE_DECL ? DECL_TEMPLATE_RESULT (NODE) : NODE)
>
> -#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
> +#if defined ENABLE_TREE_CHECKING
>
>  #define LANG_DECL_MIN_CHECK(NODE) __extension__                        \
>  ({ struct lang_decl *lt = DECL_LANG_SPECIFIC (NODE);           \
> diff --git a/gcc/cp/tree.cc b/gcc/cp/tree.cc
> index ed0d0d22950..98175bfeb11 100644
> --- a/gcc/cp/tree.cc
> +++ b/gcc/cp/tree.cc
> @@ -6129,7 +6129,7 @@ cp_tree_c_finish_parsing ()
>    deleted_copy_types = NULL;
>  }
>
> -#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
> +#if defined ENABLE_TREE_CHECKING
>  /* Complain that some language-specific thing hanging off a tree
>     node has been accessed improperly.  */
>
> diff --git a/gcc/defaults.h b/gcc/defaults.h
> index 7c7a80e596e..fbd4d8e5ae6 100644
> --- a/gcc/defaults.h
> +++ b/gcc/defaults.h
> @@ -949,7 +949,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
>  #define DEFAULT_USE_CXA_ATEXIT 0
>  #endif
>
> -#if GCC_VERSION >= 3000 && defined IN_GCC
> +#ifdef IN_GCC
>  /* These old constraint macros shouldn't appear anywhere in a
>     configuration using MD constraint definitions.  */
>  #endif
> diff --git a/gcc/diagnostic-core.h b/gcc/diagnostic-core.h
> index 286954ac2f8..0df0c896406 100644
> --- a/gcc/diagnostic-core.h
> +++ b/gcc/diagnostic-core.h
> @@ -60,11 +60,7 @@ extern const char *trim_filename (const char *);
>  /* None of these functions are suitable for ATTRIBUTE_PRINTF, because
>     each language front end can extend them with its own set of format
>     specifiers.  We must use custom format checks.  */
> -#if (CHECKING_P && GCC_VERSION >= 4001) || GCC_VERSION == BUILDING_GCC_VERSION
>  #define ATTRIBUTE_GCC_DIAG(m, n) __attribute__ ((__format__ (GCC_DIAG_STYLE, m, n))) ATTRIBUTE_NONNULL(m)
> -#else
> -#define ATTRIBUTE_GCC_DIAG(m, n) ATTRIBUTE_NONNULL(m)
> -#endif
>  extern void internal_error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2)
>       ATTRIBUTE_NORETURN;
>  extern void internal_error_no_backtrace (const char *, ...)
> diff --git a/gcc/dwarf2cfi.cc b/gcc/dwarf2cfi.cc
> index ab7c5cc5b27..6aae3bdb5aa 100644
> --- a/gcc/dwarf2cfi.cc
> +++ b/gcc/dwarf2cfi.cc
> @@ -45,9 +45,7 @@ along with GCC; see the file COPYING3.  If not see
>     totally replaced in this file; make sure it stays that way.  */
>  #undef DWARF2_UNWIND_INFO
>  #undef DWARF2_FRAME_INFO
> -#if (GCC_VERSION >= 3000)
> - #pragma GCC poison DWARF2_UNWIND_INFO DWARF2_FRAME_INFO
> -#endif
> +#pragma GCC poison DWARF2_UNWIND_INFO DWARF2_FRAME_INFO
>
>  #ifndef INCOMING_RETURN_ADDR_RTX
>  #define INCOMING_RETURN_ADDR_RTX  (gcc_unreachable (), NULL_RTX)
> diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc
> index 5681b01749a..d31818f999d 100644
> --- a/gcc/dwarf2out.cc
> +++ b/gcc/dwarf2out.cc
> @@ -133,9 +133,7 @@ int vms_file_stats_name (const char *, long long *, long *, char *, int *);
>     totally replaced in this file; make sure it stays that way.  */
>  #undef DWARF2_UNWIND_INFO
>  #undef DWARF2_FRAME_INFO
> -#if (GCC_VERSION >= 3000)
> - #pragma GCC poison DWARF2_UNWIND_INFO DWARF2_FRAME_INFO
> -#endif
> +#pragma GCC poison DWARF2_UNWIND_INFO DWARF2_FRAME_INFO
>
>  /* The size of the target's pointer type.  */
>  #ifndef PTR_SIZE
> @@ -3370,10 +3368,8 @@ bool
>  dwarf2out_default_as_loc_support (void)
>  {
>    return DWARF2_ASM_LINE_DEBUG_INFO;
> -#if (GCC_VERSION >= 3000)
> -# undef DWARF2_ASM_LINE_DEBUG_INFO
> -# pragma GCC poison DWARF2_ASM_LINE_DEBUG_INFO
> -#endif
> +#undef DWARF2_ASM_LINE_DEBUG_INFO
> +#pragma GCC poison DWARF2_ASM_LINE_DEBUG_INFO
>  }
>
>  /* Return true if GCC configure detected assembler support for views
> @@ -3383,10 +3379,8 @@ bool
>  dwarf2out_default_as_locview_support (void)
>  {
>    return DWARF2_ASM_VIEW_DEBUG_INFO;
> -#if (GCC_VERSION >= 3000)
> -# undef DWARF2_ASM_VIEW_DEBUG_INFO
> -# pragma GCC poison DWARF2_ASM_VIEW_DEBUG_INFO
> -#endif
> +#undef DWARF2_ASM_VIEW_DEBUG_INFO
> +#pragma GCC poison DWARF2_ASM_VIEW_DEBUG_INFO
>  }
>
>  /* A bit is set in ZERO_VIEW_P if we are using the assembler-supported
> diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
> index 7bf1d5a0452..7baab4bfceb 100644
> --- a/gcc/fortran/gfortran.h
> +++ b/gcc/fortran/gfortran.h
> @@ -1072,11 +1072,7 @@ typedef struct
>
>  /* In order for the "gfc" format checking to work correctly, you must
>     have declared a typedef locus first.  */
> -#if GCC_VERSION >= 4001
>  #define ATTRIBUTE_GCC_GFC(m, n) __attribute__ ((__format__ (__gcc_gfc__, m, n))) ATTRIBUTE_NONNULL(m)
> -#else
> -#define ATTRIBUTE_GCC_GFC(m, n) ATTRIBUTE_NONNULL(m)
> -#endif
>
>
>  /* Suppress error messages or re-enable them.  */
> diff --git a/gcc/gcc.cc b/gcc/gcc.cc
> index bb07cc244e3..c5b92b380b2 100644
> --- a/gcc/gcc.cc
> +++ b/gcc/gcc.cc
> @@ -163,9 +163,7 @@ env_manager::restore ()
>  }
>
>  /* Forbid other uses of getenv and putenv.  */
> -#if (GCC_VERSION >= 3000)
>  #pragma GCC poison getenv putenv
> -#endif
>
>
>
> diff --git a/gcc/genautomata.cc b/gcc/genautomata.cc
> index e43314e4ea3..a290122f62c 100644
> --- a/gcc/genautomata.cc
> +++ b/gcc/genautomata.cc
> @@ -879,7 +879,7 @@ struct state_ainsn_table
>  /* Macros to access members of unions.  Use only them for access to
>     union members of declarations and regexps.  */
>
> -#if CHECKING_P && (GCC_VERSION >= 2007)
> +#if CHECKING_P
>
>  #define DECL_UNIT(d) __extension__                                     \
>  (({ __typeof (d) const _decl = (d);                                    \
> @@ -1070,7 +1070,7 @@ regexp_mode_check_failed (enum regexp_mode mode,
>    exit (1);
>  }
>
> -#else /* #if CHECKING_P && (GCC_VERSION >= 2007) */
> +#else /* #if CHECKING_P */
>
>  #define DECL_UNIT(d) (&(d)->decl.unit)
>  #define DECL_BYPASS(d) (&(d)->decl.bypass)
> @@ -1088,7 +1088,7 @@ regexp_mode_check_failed (enum regexp_mode mode,
>  #define REGEXP_ALLOF(r) (&(r)->regexp.allof)
>  #define REGEXP_ONEOF(r) (&(r)->regexp.oneof)
>
> -#endif /* #if CHECKING_P && (GCC_VERSION >= 2007) */
> +#endif /* #if CHECKING_P */
>
>  #define XCREATENODE(T) ((T *) create_node (sizeof (T)))
>  #define XCREATENODEVEC(T, N) ((T *) create_node (sizeof (T) * (N)))
> diff --git a/gcc/genconditions.cc b/gcc/genconditions.cc
> index f63a3f495c5..8845309fd91 100644
> --- a/gcc/genconditions.cc
> +++ b/gcc/genconditions.cc
> @@ -58,7 +58,6 @@ write_header (void)
>  /* It is necessary, but not entirely safe, to include the headers below\n\
>     in a generator program.  As a defensive measure, don't do so when the\n\
>     table isn't going to have anything in it.  */\n\
> -#if GCC_VERSION >= 3001\n\
>  \n\
>  /* Do not allow checking to confuse the issue.  */\n\
>  #undef CHECKING_P\n\
> @@ -108,8 +107,7 @@ write_header (void)
>  extern rtx_insn *insn;\n\
>  extern rtx ins1;\n\
>  extern rtx operands[];\n\
> -\n\
> -#endif /* gcc >= 3.0.1 */\n");
> +\n");
>  }
>
>  /* Write out one entry in the conditions table, using the data pointed
> @@ -170,12 +168,11 @@ struct c_test\n\
>     vary at run time.  It works in 3.0.1 and later; 3.0 only when not\n\
>     optimizing.  */\n\
>  \n\
> -#if GCC_VERSION >= 3001\n\
>  static const struct c_test insn_conditions[] = {\n");
>
>    traverse_c_tests (write_one_condition, 0);
>
> -  puts ("  { nullptr, -1 }\n};\n#endif /* gcc >= 3.0.1 */\n");
> +  puts ("  { nullptr, -1 }\n};\n");
>  }
>
>  /* Emit code which will convert the C-format table to a
> @@ -191,7 +188,6 @@ write_writer (void)
>         "  unsigned int i;\n"
>          "  const char *p;\n"
>          "  puts (\"(define_conditions [\");\n"
> -       "#if GCC_VERSION >= 3001\n"
>         "  for (i = 0; i < ARRAY_SIZE (insn_conditions) - 1; i++)\n"
>         "    {\n"
>         "      printf (\"  (%d \\\"\", insn_conditions[i].value);\n"
> @@ -207,7 +203,6 @@ write_writer (void)
>         "        }\n"
>          "      puts (\"\\\")\");\n"
>          "    }\n"
> -       "#endif /* gcc >= 3.0.1 */\n"
>         "  puts (\"])\");\n"
>          "  fflush (stdout);\n"
>          "return ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE;\n"
> diff --git a/gcc/genmatch.cc b/gcc/genmatch.cc
> index 2eda7300821..a10a51b0c13 100644
> --- a/gcc/genmatch.cc
> +++ b/gcc/genmatch.cc
> @@ -70,9 +70,7 @@ linemap_client_expand_location_to_spelling_point (location_t loc,
>  }
>
>  static bool
> -#if GCC_VERSION >= 4001
>  __attribute__((format (printf, 5, 0)))
> -#endif
>  diagnostic_cb (cpp_reader *, enum cpp_diagnostic_level errtype,
>                enum cpp_warning_reason, rich_location *richloc,
>                const char *msg, va_list *ap)
> @@ -115,9 +113,7 @@ notfound:
>  }
>
>  static void
> -#if GCC_VERSION >= 4001
>  __attribute__((format (printf, 2, 3)))
> -#endif
>  fatal_at (const cpp_token *tk, const char *msg, ...)
>  {
>    rich_location richloc (line_table, tk->src_loc);
> @@ -128,9 +124,7 @@ fatal_at (const cpp_token *tk, const char *msg, ...)
>  }
>
>  static void
> -#if GCC_VERSION >= 4001
>  __attribute__((format (printf, 2, 3)))
> -#endif
>  fatal_at (location_t loc, const char *msg, ...)
>  {
>    rich_location richloc (line_table, loc);
> @@ -141,9 +135,7 @@ fatal_at (location_t loc, const char *msg, ...)
>  }
>
>  static void
> -#if GCC_VERSION >= 4001
>  __attribute__((format (printf, 2, 3)))
> -#endif
>  warning_at (const cpp_token *tk, const char *msg, ...)
>  {
>    rich_location richloc (line_table, tk->src_loc);
> @@ -154,9 +146,7 @@ warning_at (const cpp_token *tk, const char *msg, ...)
>  }
>
>  static void
> -#if GCC_VERSION >= 4001
>  __attribute__((format (printf, 2, 3)))
> -#endif
>  warning_at (location_t loc, const char *msg, ...)
>  {
>    rich_location richloc (line_table, loc);
> @@ -169,9 +159,7 @@ warning_at (location_t loc, const char *msg, ...)
>  /* Like fprintf, but print INDENT spaces at the beginning.  */
>
>  static void
> -#if GCC_VERSION >= 4001
>  __attribute__((format (printf, 3, 4)))
> -#endif
>  fprintf_indent (FILE *f, unsigned int indent, const char *format, ...)
>  {
>    va_list ap;
> diff --git a/gcc/genmodes.cc b/gcc/genmodes.cc
> index 59850bb070a..0f4d746c157 100644
> --- a/gcc/genmodes.cc
> +++ b/gcc/genmodes.cc
> @@ -1399,13 +1399,13 @@ emit_insn_modes_inline_h (void)
>  #ifndef GCC_INSN_MODES_INLINE_H\n\
>  #define GCC_INSN_MODES_INLINE_H");
>
> -  puts ("\n#if !defined (USED_FOR_TARGET) && GCC_VERSION >= 4001\n");
> +  puts ("\n#if !defined (USED_FOR_TARGET)\n");
>    emit_mode_size_inline ();
>    emit_mode_nunits_inline ();
>    emit_mode_inner_inline ();
>    emit_mode_unit_size_inline ();
>    emit_mode_unit_precision_inline ();
> -  puts ("#endif /* GCC_VERSION >= 4001 */");
> +  puts ("#endif");
>
>    puts ("\
>  \n\
> diff --git a/gcc/genoutput.cc b/gcc/genoutput.cc
> index 6bb03e2864f..853bec0201d 100644
> --- a/gcc/genoutput.cc
> +++ b/gcc/genoutput.cc
> @@ -291,7 +291,7 @@ output_insn_data (void)
>         break;
>        }
>
> -  printf ("#if GCC_VERSION >= 2007\n__extension__\n#endif\n");
> +  printf ("\n__extension__\n");
>    printf ("\nconst struct insn_data_d insn_data[] = \n{\n");
>
>    for (d = idata; d; d = d->next)
> diff --git a/gcc/ggc-page.cc b/gcc/ggc-page.cc
> index 7a7a1b0901f..8fe07b80066 100644
> --- a/gcc/ggc-page.cc
> +++ b/gcc/ggc-page.cc
> @@ -568,11 +568,7 @@ push_by_depth (page_entry *p, unsigned long *s)
>    G.save_in_use[G.by_depth_in_use++] = s;
>  }
>
> -#if (GCC_VERSION < 3001)
> -#define prefetch(X) ((void) X)
> -#else
>  #define prefetch(X) __builtin_prefetch (X)
> -#endif
>
>  #define save_in_use_p_i(__i) \
>    (G.save_in_use[__i])
> @@ -1340,12 +1336,7 @@ ggc_internal_alloc (size_t size, void (*f)(void *), size_t s, size_t n
>           while (~entry->in_use_p[word] == 0)
>             ++word;
>
> -#if GCC_VERSION >= 3004
>           bit = __builtin_ctzl (~entry->in_use_p[word]);
> -#else
> -         while ((entry->in_use_p[word] >> bit) & 1)
> -           ++bit;
> -#endif
>
>           hint = word * HOST_BITS_PER_LONG + bit;
>         }
> diff --git a/gcc/ggc-tests.cc b/gcc/ggc-tests.cc
> index 620989489b6..d028da339e6 100644
> --- a/gcc/ggc-tests.cc
> +++ b/gcc/ggc-tests.cc
> @@ -180,10 +180,8 @@ int test_struct_with_dtor::dtor_call_count;
>  static void
>  test_finalization ()
>  {
> -#if GCC_VERSION >= 4003
>    ASSERT_FALSE (need_finalization_p <test_struct> ());
>    ASSERT_TRUE (need_finalization_p <test_struct_with_dtor> ());
> -#endif
>
>    /* Create some garbage.  */
>    const int count = 10;
> diff --git a/gcc/ggc.h b/gcc/ggc.h
> index aeec1bafb9b..0f72f368a72 100644
> --- a/gcc/ggc.h
> +++ b/gcc/ggc.h
> @@ -170,11 +170,7 @@ template<typename T>
>  inline bool
>  need_finalization_p ()
>  {
> -#if GCC_VERSION >= 4003
>    return !__has_trivial_destructor (T);
> -#else
> -  return true;
> -#endif
>  }
>
>  template<typename T>
> diff --git a/gcc/hwint.cc b/gcc/hwint.cc
> index e53e0bf7906..fa2df400842 100644
> --- a/gcc/hwint.cc
> +++ b/gcc/hwint.cc
> @@ -21,110 +21,6 @@ along with GCC; see the file COPYING3.  If not see
>  #include "system.h"
>  #include "coretypes.h"
>
> -#if GCC_VERSION < 3004
> -
> -/* The functions clz_hwi, ctz_hwi, ffs_hwi, floor_log2, ceil_log2,
> -   and exact_log2 are defined as inline functions in hwint.h
> -   if GCC_VERSION >= 3004.
> -   The definitions here are used for older versions of GCC and
> -   non-GCC bootstrap compilers.  */
> -
> -/* Given X, an unsigned number, return the largest int Y such that 2**Y <= X.
> -   If X is 0, return -1.  */
> -
> -int
> -floor_log2 (unsigned HOST_WIDE_INT x)
> -{
> -  int t = 0;
> -
> -  if (x == 0)
> -    return -1;
> -
> -  if (HOST_BITS_PER_WIDE_INT > 64)
> -    if (x >= HOST_WIDE_INT_1U << (t + 64))
> -      t += 64;
> -  if (HOST_BITS_PER_WIDE_INT > 32)
> -    if (x >= HOST_WIDE_INT_1U << (t + 32))
> -      t += 32;
> -  if (x >= HOST_WIDE_INT_1U << (t + 16))
> -    t += 16;
> -  if (x >= HOST_WIDE_INT_1U << (t + 8))
> -    t += 8;
> -  if (x >= HOST_WIDE_INT_1U << (t + 4))
> -    t += 4;
> -  if (x >= HOST_WIDE_INT_1U << (t + 2))
> -    t += 2;
> -  if (x >= HOST_WIDE_INT_1U << (t + 1))
> -    t += 1;
> -
> -  return t;
> -}
> -
> -/* Given X, an unsigned number, return the least Y such that 2**Y >= X.  */
> -
> -int
> -ceil_log2 (unsigned HOST_WIDE_INT x)
> -{
> -  return x == 0 ? 0 : floor_log2 (x - 1) + 1;
> -}
> -
> -/* Return the logarithm of X, base 2, considering X unsigned,
> -   if X is a power of 2.  Otherwise, returns -1.  */
> -
> -int
> -exact_log2 (unsigned HOST_WIDE_INT x)
> -{
> -  if (!pow2p_hwi (x))
> -    return -1;
> -  return floor_log2 (x);
> -}
> -
> -/* Given X, an unsigned number, return the number of least significant bits
> -   that are zero.  When X == 0, the result is the word size.  */
> -
> -int
> -ctz_hwi (unsigned HOST_WIDE_INT x)
> -{
> -  return x ? floor_log2 (least_bit_hwi (x)) : HOST_BITS_PER_WIDE_INT;
> -}
> -
> -/* Similarly for most significant bits.  */
> -
> -int
> -clz_hwi (unsigned HOST_WIDE_INT x)
> -{
> -  return HOST_BITS_PER_WIDE_INT - 1 - floor_log2 (x);
> -}
> -
> -/* Similar to ctz_hwi, except that the least significant bit is numbered
> -   starting from 1, and X == 0 yields 0.  */
> -
> -int
> -ffs_hwi (unsigned HOST_WIDE_INT x)
> -{
> -  return 1 + floor_log2 (least_bit_hwi (x));
> -}
> -
> -/* Return the number of set bits in X.  */
> -
> -int
> -popcount_hwi (unsigned HOST_WIDE_INT x)
> -{
> -  int i, ret = 0;
> -  size_t bits = sizeof (x) * CHAR_BIT;
> -
> -  for (i = 0; i < bits; i += 1)
> -    {
> -      ret += x & 1;
> -      x >>= 1;
> -    }
> -
> -  return ret;
> -}
> -
> -#endif /* GCC_VERSION < 3004 */
> -
> -
>  /* Compute the greatest common divisor of two numbers A and B using
>     Euclid's algorithm.  */
>
> diff --git a/gcc/hwint.h b/gcc/hwint.h
> index c160bea0cb2..f3b5a779a65 100644
> --- a/gcc/hwint.h
> +++ b/gcc/hwint.h
> @@ -28,18 +28,16 @@
>  #define HOST_LONG_LONG_FORMAT "ll"
>  #endif
>
> -/* If HAVE_LONG_LONG and SIZEOF_LONG_LONG aren't defined, but
> -   GCC_VERSION >= 3000, assume this is the second or later stage of a
> +/* If HAVE_LONG_LONG and SIZEOF_LONG_LONG aren't defined
> +   assume this is the second or later stage of a
>     bootstrap, we do have long long, and it's 64 bits.  (This is
>     required by C99; we do have some ports that violate that assumption
>     but they're all cross-compile-only.)  Just in case, force a
>     constraint violation if that assumption is incorrect.  */
>  #if !defined HAVE_LONG_LONG
> -# if GCC_VERSION >= 3000
> -#  define HAVE_LONG_LONG 1
> -#  define SIZEOF_LONG_LONG 8
> +# define HAVE_LONG_LONG 1
> +# define SIZEOF_LONG_LONG 8
>  extern char sizeof_long_long_must_be_8[sizeof (long long) == 8 ? 1 : -1];
> -# endif
>  #endif
>
>  #ifdef HAVE_LONG_LONG
> @@ -160,26 +158,6 @@ pow2p_hwi (unsigned HOST_WIDE_INT x)
>    return x && pow2_or_zerop (x);
>  }
>
> -#if GCC_VERSION < 3004
> -
> -extern int clz_hwi (unsigned HOST_WIDE_INT x);
> -extern int ctz_hwi (unsigned HOST_WIDE_INT x);
> -extern int ffs_hwi (unsigned HOST_WIDE_INT x);
> -
> -/* Return the number of set bits in X.  */
> -extern int popcount_hwi (unsigned HOST_WIDE_INT x);
> -
> -/* Return log2, or -1 if not exact.  */
> -extern int exact_log2                  (unsigned HOST_WIDE_INT);
> -
> -/* Return floor of log2, with -1 for zero.  */
> -extern int floor_log2                  (unsigned HOST_WIDE_INT);
> -
> -/* Return the smallest n such that 2**n >= X.  */
> -extern int ceil_log2                   (unsigned HOST_WIDE_INT);
> -
> -#else /* GCC_VERSION >= 3004 */
> -
>  /* For convenience, define 0 -> word_size.  */
>  static inline int
>  clz_hwi (unsigned HOST_WIDE_INT x)
> @@ -251,8 +229,6 @@ exact_log2 (unsigned HOST_WIDE_INT x)
>    return pow2p_hwi (x) ? ctz_hwi (x) : -1;
>  }
>
> -#endif /* GCC_VERSION >= 3004 */
> -
>  #define HOST_WIDE_INT_MIN (HOST_WIDE_INT) \
>    (HOST_WIDE_INT_1U << (HOST_BITS_PER_WIDE_INT - 1))
>  #define HOST_WIDE_INT_MAX (~(HOST_WIDE_INT_MIN))
> diff --git a/gcc/ira-int.h b/gcc/ira-int.h
> index f42a314fa7f..76ce6b4d75c 100644
> --- a/gcc/ira-int.h
> +++ b/gcc/ira-int.h
> @@ -151,7 +151,7 @@ extern int ira_loop_tree_height;
>  extern ira_loop_tree_node_t ira_bb_nodes;
>
>  /* Two access macros to the nodes representing basic blocks.  */
> -#if defined ENABLE_IRA_CHECKING && (GCC_VERSION >= 2007)
> +#ifdef ENABLE_IRA_CHECKING
>  #define IRA_BB_NODE_BY_INDEX(index) __extension__                      \
>  (({ ira_loop_tree_node_t _node = (&ira_bb_nodes[index]);               \
>       if (_node->children != NULL || _node->loop != NULL || _node->bb == NULL)\
> @@ -173,7 +173,7 @@ extern ira_loop_tree_node_t ira_bb_nodes;
>  extern ira_loop_tree_node_t ira_loop_nodes;
>
>  /* Two access macros to the nodes representing loops.  */
> -#if defined ENABLE_IRA_CHECKING && (GCC_VERSION >= 2007)
> +#ifdef ENABLE_IRA_CHECKING
>  #define IRA_LOOP_NODE_BY_INDEX(index) __extension__                    \
>  (({ ira_loop_tree_node_t const _node = (&ira_loop_nodes[index]);       \
>       if (_node->children == NULL || _node->bb != NULL                  \
> @@ -655,7 +655,7 @@ extern int ira_move_loops_num, ira_additional_jumps_num;
>  /* Set, clear or test bit number I in R, a bit vector of elements with
>     minimal index and maximal index equal correspondingly to MIN and
>     MAX.  */
> -#if defined ENABLE_IRA_CHECKING && (GCC_VERSION >= 2007)
> +#ifdef ENABLE_IRA_CHECKING
>
>  #define SET_MINMAX_SET_BIT(R, I, MIN, MAX) __extension__               \
>    (({ int _min = (MIN), _max = (MAX), _i = (I);                                \
> diff --git a/gcc/jit/jit-common.h b/gcc/jit/jit-common.h
> index 3ff7447fbf3..773a2d8df43 100644
> --- a/gcc/jit/jit-common.h
> +++ b/gcc/jit/jit-common.h
> @@ -29,11 +29,7 @@ along with GCC; see the file COPYING3.  If not see
>  #include "tree-iterator.h"
>
>  #ifdef GCC_VERSION
> -#if GCC_VERSION >= 4001
>  #define GNU_PRINTF(M, N) __attribute__ ((format (gnu_printf, (M), (N))))
> -#else
> -#define GNU_PRINTF(M, N)
> -#endif
>  #endif
>
>  const int NUM_GCC_JIT_TYPES = GCC_JIT_TYPE_INT128_T + 1;
> diff --git a/gcc/machmode.h b/gcc/machmode.h
> index 45df720df73..d84bdd5797d 100644
> --- a/gcc/machmode.h
> +++ b/gcc/machmode.h
> @@ -545,12 +545,8 @@ complex_mode::includes_p (machine_mode m)
>  ALWAYS_INLINE poly_uint16
>  mode_to_bytes (machine_mode mode)
>  {
> -#if GCC_VERSION >= 4001
>    return (__builtin_constant_p (mode)
>           ? mode_size_inline (mode) : mode_size[mode]);
> -#else
> -  return mode_size[mode];
> -#endif
>  }
>
>  /* Return the base GET_MODE_BITSIZE value for MODE.  */
> @@ -574,13 +570,9 @@ mode_to_precision (machine_mode mode)
>  ALWAYS_INLINE scalar_mode
>  mode_to_inner (machine_mode mode)
>  {
> -#if GCC_VERSION >= 4001
>    return scalar_mode::from_int (__builtin_constant_p (mode)
>                                 ? mode_inner_inline (mode)
>                                 : mode_inner[mode]);
> -#else
> -  return scalar_mode::from_int (mode_inner[mode]);
> -#endif
>  }
>
>  /* Return the base GET_MODE_UNIT_SIZE value for MODE.  */
> @@ -588,12 +580,8 @@ mode_to_inner (machine_mode mode)
>  ALWAYS_INLINE unsigned char
>  mode_to_unit_size (machine_mode mode)
>  {
> -#if GCC_VERSION >= 4001
>    return (__builtin_constant_p (mode)
>           ? mode_unit_size_inline (mode) : mode_unit_size[mode]);
> -#else
> -  return mode_unit_size[mode];
> -#endif
>  }
>
>  /* Return the base GET_MODE_UNIT_PRECISION value for MODE.  */
> @@ -601,12 +589,8 @@ mode_to_unit_size (machine_mode mode)
>  ALWAYS_INLINE unsigned short
>  mode_to_unit_precision (machine_mode mode)
>  {
> -#if GCC_VERSION >= 4001
>    return (__builtin_constant_p (mode)
>           ? mode_unit_precision_inline (mode) : mode_unit_precision[mode]);
> -#else
> -  return mode_unit_precision[mode];
> -#endif
>  }
>
>  /* Return the base GET_MODE_NUNITS value for MODE.  */
> @@ -614,12 +598,8 @@ mode_to_unit_precision (machine_mode mode)
>  ALWAYS_INLINE poly_uint16
>  mode_to_nunits (machine_mode mode)
>  {
> -#if GCC_VERSION >= 4001
>    return (__builtin_constant_p (mode)
>           ? mode_nunits_inline (mode) : mode_nunits[mode]);
> -#else
> -  return mode_nunits[mode];
> -#endif
>  }
>
>  /* Get the size in bytes of an object of mode MODE.  */
> diff --git a/gcc/output.h b/gcc/output.h
> index 6dea630913a..2fce8b5c19f 100644
> --- a/gcc/output.h
> +++ b/gcc/output.h
> @@ -115,11 +115,7 @@ extern void output_addr_const (FILE *, rtx);
>
>  /* Output a string of assembler code, substituting numbers, strings
>     and fixed syntactic prefixes.  */
> -#if GCC_VERSION >= 3004
>  #define ATTRIBUTE_ASM_FPRINTF(m, n) __attribute__ ((__format__ (__asm_fprintf__, m, n))) ATTRIBUTE_NONNULL(m)
> -#else
> -#define ATTRIBUTE_ASM_FPRINTF(m, n) ATTRIBUTE_NONNULL(m)
> -#endif
>
>  extern void fprint_whex (FILE *, unsigned HOST_WIDE_INT);
>  extern void fprint_ul (FILE *, unsigned long);
> diff --git a/gcc/pretty-print.h b/gcc/pretty-print.h
> index fc588447460..425ae339ae0 100644
> --- a/gcc/pretty-print.h
> +++ b/gcc/pretty-print.h
> @@ -374,11 +374,7 @@ extern void pp_separate_with (pretty_printer *, char);
>
>  /* This header may be included before diagnostics-core.h, hence the duplicate
>     definitions to allow for GCC-specific formats.  */
> -#if GCC_VERSION >= 3005
>  #define ATTRIBUTE_GCC_PPDIAG(m, n) __attribute__ ((__format__ (GCC_PPDIAG_STYLE, m ,n))) ATTRIBUTE_NONNULL(m)
> -#else
> -#define ATTRIBUTE_GCC_PPDIAG(m, n) ATTRIBUTE_NONNULL(m)
> -#endif
>  extern void pp_printf (pretty_printer *, const char *, ...)
>       ATTRIBUTE_GCC_PPDIAG(2,3);
>
> diff --git a/gcc/rtl.cc b/gcc/rtl.cc
> index 86c322b19ca..74be7342803 100644
> --- a/gcc/rtl.cc
> +++ b/gcc/rtl.cc
> @@ -869,7 +869,7 @@ dump_rtx_statistics (void)
>    fprintf (stderr, "-----------------------------------------------\n");
>  }
>
> -#if defined ENABLE_RTL_CHECKING && (GCC_VERSION >= 2007)
> +#ifdef ENABLE_RTL_CHECKING
>
>  /* Disable warnings about missing quoting in GCC diagnostics for
>     the internal_error calls.  Their format strings deliberately don't
> diff --git a/gcc/rtl.h b/gcc/rtl.h
> index 488016bb42a..5e77be2f024 100644
> --- a/gcc/rtl.h
> +++ b/gcc/rtl.h
> @@ -1076,7 +1076,7 @@ is_a_helper <rtx_note *>::test (rtx_insn *insn)
>
>  /* General accessor macros for accessing the fields of an rtx.  */
>
> -#if defined ENABLE_RTL_CHECKING && (GCC_VERSION >= 2007)
> +#if defined ENABLE_RTL_CHECKING
>  /* The bit with a star outside the statement expr and an & inside is
>     so that N can be evaluated only once.  */
>  #define RTL_CHECK1(RTX, N, C1) __extension__                           \
> @@ -1257,7 +1257,7 @@ extern void rtvec_check_failed_bounds (const_rtvec, int, const char *, int,
>  /* Access an individual rtx flag, with no checking of any kind.  */
>  #define RTX_FLAG(RTX, FLAG)    ((RTX)->FLAG)
>
> -#if defined ENABLE_RTL_FLAG_CHECKING && (GCC_VERSION >= 2007)
> +#if defined ENABLE_RTL_FLAG_CHECKING
>  #define RTL_FLAG_CHECK1(NAME, RTX, C1) __extension__                   \
>  ({ __typeof (RTX) const _rtx = (RTX);                                  \
>     if (GET_CODE (_rtx) != C1)                                          \
> @@ -1823,7 +1823,7 @@ enum label_kind
>    LABEL_WEAK_ENTRY     /* alternate entry point, exported as weak symbol */
>  };
>
> -#if defined ENABLE_RTL_FLAG_CHECKING && (GCC_VERSION > 2007)
> +#if defined ENABLE_RTL_FLAG_CHECKING
>
>  /* Retrieve the kind of LABEL.  */
>  #define LABEL_KIND(LABEL) __extension__                                        \
> diff --git a/gcc/sbitmap.cc b/gcc/sbitmap.cc
> index 5ac2b6d0f67..0a6fddadab8 100644
> --- a/gcc/sbitmap.cc
> +++ b/gcc/sbitmap.cc
> @@ -375,33 +375,6 @@ bitmap_bit_in_range_p (const_sbitmap bmap, unsigned int start, unsigned int end)
>    return (bmap->elms[start_word] & mask) != 0;
>  }
>
> -#if GCC_VERSION < 3400
> -/* Table of number of set bits in a character, indexed by value of char.  */
> -static const unsigned char popcount_table[] =
> -{
> -    0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,
> -    1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
> -    1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
> -    2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
> -    1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
> -    2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
> -    2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
> -    3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,4,5,5,6,5,6,6,7,5,6,6,7,6,7,7,8,
> -};
> -
> -static unsigned long
> -sbitmap_popcount (SBITMAP_ELT_TYPE a)
> -{
> -  unsigned long ret = 0;
> -  unsigned i;
> -
> -  /* Just do this the table way for now  */
> -  for (i = 0; i < HOST_BITS_PER_WIDEST_FAST_INT; i += 8)
> -    ret += popcount_table[(a >> i) & 0xff];
> -  return ret;
> -}
> -#endif
> -
>  /* Count and return the number of bits set in the bitmap BMAP.  */
>
>  unsigned int
> @@ -411,16 +384,12 @@ bitmap_count_bits (const_sbitmap bmap)
>    for (unsigned int i = 0; i < bmap->size; i++)
>      if (bmap->elms[i])
>        {
> -#if GCC_VERSION < 3400
> -       count += sbitmap_popcount (bmap->elms[i]);
> -#else
> -# if HOST_BITS_PER_WIDEST_FAST_INT == HOST_BITS_PER_LONG
> +#if HOST_BITS_PER_WIDEST_FAST_INT == HOST_BITS_PER_LONG
>         count += __builtin_popcountl (bmap->elms[i]);
> -# elif HOST_BITS_PER_WIDEST_FAST_INT == HOST_BITS_PER_LONGLONG
> +#elif HOST_BITS_PER_WIDEST_FAST_INT == HOST_BITS_PER_LONGLONG
>         count += __builtin_popcountll (bmap->elms[i]);
> -# else
> +#else
>         count += __builtin_popcount (bmap->elms[i]);
> -# endif
>  #endif
>        }
>    return count;
> diff --git a/gcc/stringpool.h b/gcc/stringpool.h
> index 5e301c6011b..b43110cc7a0 100644
> --- a/gcc/stringpool.h
> +++ b/gcc/stringpool.h
> @@ -33,11 +33,9 @@ extern tree maybe_get_identifier (const char *);
>     known.  */
>  extern tree get_identifier_with_length (const char *, size_t);
>
> -#if GCC_VERSION >= 3000
>  #define get_identifier(str) \
>    (__builtin_constant_p (str)                          \
>      ? get_identifier_with_length ((str), strlen (str))  \
>      : get_identifier (str))
> -#endif
>
>  #endif  // GCC_STRINGPOOL_H
> diff --git a/gcc/system.h b/gcc/system.h
> index c5562cc49a3..1688b763ef5 100644
> --- a/gcc/system.h
> +++ b/gcc/system.h
> @@ -596,17 +596,15 @@ extern int vsnprintf (char *, size_t, const char *, va_list);
>  #ifdef __cplusplus
>  #define HAVE_DESIGNATED_INITIALIZERS 0
>  #else
> -#define HAVE_DESIGNATED_INITIALIZERS \
> -  ((GCC_VERSION >= 2007) || (__STDC_VERSION__ >= 199901L))
> +#define HAVE_DESIGNATED_INITIALIZERS 1
>  #endif
>  #endif
>
>  #if !defined(HAVE_DESIGNATED_UNION_INITIALIZERS)
>  #ifdef __cplusplus
> -#define HAVE_DESIGNATED_UNION_INITIALIZERS (GCC_VERSION >= 4007)
> +#define HAVE_DESIGNATED_UNION_INITIALIZERS 1
>  #else
> -#define HAVE_DESIGNATED_UNION_INITIALIZERS \
> -  ((GCC_VERSION >= 2007) || (__STDC_VERSION__ >= 199901L))
> +#define HAVE_DESIGNATED_UNION_INITIALIZERS 1
>  #endif
>  #endif
>
> @@ -722,20 +720,6 @@ extern int vsnprintf (char *, size_t, const char *, va_list);
>  #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *) 0)->MEMBER)
>  #endif
>
> -/* Various error reporting routines want to use __FUNCTION__.  */
> -#if (GCC_VERSION < 2007)
> -#ifndef __FUNCTION__
> -#define __FUNCTION__ "?"
> -#endif /* ! __FUNCTION__ */
> -#endif
> -
> -/* __builtin_expect(A, B) evaluates to A, but notifies the compiler that
> -   the most likely value of A is B.  This feature was added at some point
> -   between 2.95 and 3.0.  Let's use 3.0 as the lower bound for now.  */
> -#if (GCC_VERSION < 3000)
> -#define __builtin_expect(a, b) (a)
> -#endif
> -
>  /* Some of the headers included by <memory> can use "abort" within a
>     namespace, e.g. "_VSTD::abort();", which fails after we use the
>     preprocessor to redefine "abort" as "fancy_abort" below.  */
> @@ -781,12 +765,9 @@ extern void fancy_abort (const char *, int, const char *)
>  #if ENABLE_ASSERT_CHECKING
>  #define gcc_assert(EXPR)                                               \
>     ((void)(!(EXPR) ? fancy_abort (__FILE__, __LINE__, __FUNCTION__), 0 : 0))
> -#elif (GCC_VERSION >= 4005)
> +#else
>  #define gcc_assert(EXPR)                                               \
>    ((void)(__builtin_expect (!(EXPR), 0) ? __builtin_unreachable (), 0 : 0))
> -#else
> -/* Include EXPR, so that unused variable warnings do not occur.  */
> -#define gcc_assert(EXPR) ((void)(0 && (EXPR)))
>  #endif
>
>  #if CHECKING_P
> @@ -796,21 +777,13 @@ extern void fancy_abort (const char *, int, const char *)
>  #define gcc_checking_assert(EXPR) ((void)(0 && (EXPR)))
>  #endif
>
> -#if GCC_VERSION >= 4000
>  #define ALWAYS_INLINE inline __attribute__ ((always_inline))
> -#else
> -#define ALWAYS_INLINE inline
> -#endif
>
> -#if GCC_VERSION >= 3004
>  #define WARN_UNUSED_RESULT __attribute__ ((__warn_unused_result__))
> -#else
> -#define WARN_UNUSED_RESULT
> -#endif
>
>  /* Use gcc_unreachable() to mark unreachable locations (like an
>     unreachable default case of a switch.  Do not use gcc_assert(0).  */
> -#if (GCC_VERSION >= 4005) && !ENABLE_ASSERT_CHECKING
> +#if !ENABLE_ASSERT_CHECKING
>  #define gcc_unreachable() __builtin_unreachable ()
>  #else
>  #define gcc_unreachable() (fancy_abort (__FILE__, __LINE__, __FUNCTION__))
> @@ -826,11 +799,7 @@ extern void fancy_abort (const char *, int, const char *)
>  # define gcc_fallthrough()
>  #endif
>
> -#if GCC_VERSION >= 3001
>  #define STATIC_CONSTANT_P(X) (__builtin_constant_p (X) && (X))
> -#else
> -#define STATIC_CONSTANT_P(X) (false && (X))
> -#endif
>
>  /* static_assert (COND, MESSAGE) is available in C++11 onwards.  */
>  #if __cplusplus >= 201103L
> @@ -871,12 +840,6 @@ extern void fancy_abort (const char *, int, const char *)
>  /* Some compilers do not allow the use of unsigned char in bitfields.  */
>  #define BOOL_BITFIELD unsigned int
>
> -/* GCC older than 4.4 have broken C++ value initialization handling, see
> -   PR11309, PR30111, PR33916, PR82939 and PR84405 for more details.  */
> -#if GCC_VERSION > 0 && GCC_VERSION < 4004 && !defined(__clang__)
> -# define BROKEN_VALUE_INITIALIZATION
> -#endif
> -
>  /* As the last action in this file, we poison the identifiers that
>     shouldn't be used.  Note, luckily gcc-3.0's token-based integrated
>     preprocessor won't trip on poisoned identifiers that arrive from
> @@ -899,8 +862,6 @@ extern void fancy_abort (const char *, int, const char *)
>  #define realloc xrealloc
>  #endif
>
> -#if (GCC_VERSION >= 3000)
> -
>  /* Note autoconf checks for prototype declarations and includes
>     system.h while doing so.  Only poison these tokens if actually
>     compiling gcc, so that the autoconf declaration tests for malloc
> @@ -1130,8 +1091,6 @@ extern void fancy_abort (const char *, int, const char *)
>     'if (flag_checking)', or with CHECKING_P macro.  */
>  #pragma GCC poison ENABLE_CHECKING
>
> -#endif /* GCC >= 3.0 */
> -
>  /* This macro allows casting away const-ness to pass -Wcast-qual
>     warnings.  DO NOT USE THIS UNLESS YOU REALLY HAVE TO!  It should
>     only be used in certain specific cases.  One valid case is where
> @@ -1151,7 +1110,7 @@ extern void fancy_abort (const char *, int, const char *)
>  #ifdef __cplusplus
>  #define CONST_CAST2(TOTYPE,FROMTYPE,X) (const_cast<TOTYPE> (X))
>  #else
> -#if defined(__GNUC__) && GCC_VERSION > 4000
> +#ifdef __GNUC__
>  /* GCC 4.0.x has a bug where it may ICE on this expression,
>     so does GCC 3.4.x (PR17436).  */
>  #define CONST_CAST2(TOTYPE,FROMTYPE,X) ((__extension__(union {FROMTYPE _q; TOTYPE _nq;})(X))._nq)
> @@ -1182,13 +1141,9 @@ helper_const_non_const_cast (const char *p)
>
>  /* Activate certain diagnostics as warnings (not errors via the
>     -Werror flag).  */
> -#if GCC_VERSION >= 4003
> -/* If asserts are disabled, activate -Wuninitialized as a warning (not
> -   an error/-Werror).  */
>  #ifndef ENABLE_ASSERT_CHECKING
>  #pragma GCC diagnostic warning "-Wuninitialized"
>  #endif
> -#endif
>
>  #ifdef ENABLE_VALGRIND_ANNOTATIONS
>  # ifdef HAVE_VALGRIND_MEMCHECK_H
> @@ -1229,13 +1184,8 @@ helper_const_non_const_cast (const char *p)
>
>  /* In LTO -fwhole-program build we still want to keep the debug functions available
>     for debugger.  Mark them as used to prevent removal.  */
> -#if (GCC_VERSION > 4000)
>  #define DEBUG_FUNCTION __attribute__ ((__used__))
>  #define DEBUG_VARIABLE __attribute__ ((__used__))
> -#else
> -#define DEBUG_FUNCTION
> -#define DEBUG_VARIABLE
> -#endif
>
>  /* General macro to extract bit Y of X.  */
>  #define TEST_BIT(X, Y) (((X) >> (Y)) & 1)
> diff --git a/gcc/tree-vrp.cc b/gcc/tree-vrp.cc
> index 0cbd9d369ca..436fafcaa0f 100644
> --- a/gcc/tree-vrp.cc
> +++ b/gcc/tree-vrp.cc
> @@ -2955,12 +2955,7 @@ vrp_asserts::find_switch_asserts (basic_block bb, gswitch *last)
>    edge e;
>    struct case_info *ci;
>    size_t n = gimple_switch_num_labels (last);
> -#if GCC_VERSION >= 4000
>    unsigned int idx;
> -#else
> -  /* Work around GCC 3.4 bug (PR 37086).  */
> -  volatile unsigned int idx;
> -#endif
>
>    bsi = gsi_for_stmt (last);
>    op = gimple_switch_index (last);
> diff --git a/gcc/tree.cc b/gcc/tree.cc
> index 5e8876d2b38..22df459c53e 100644
> --- a/gcc/tree.cc
> +++ b/gcc/tree.cc
> @@ -8771,7 +8771,7 @@ get_file_function_name (const char *type)
>    return get_identifier (buf);
>  }
>
> -#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
> +#ifdef ENABLE_TREE_CHECKING
>
>  /* Complain that the tree code of NODE does not match the expected 0
>     terminated list of trailing codes. The trailing code list can be
> diff --git a/gcc/tree.h b/gcc/tree.h
> index 82eb8ba39d2..c53d34f6a47 100644
> --- a/gcc/tree.h
> +++ b/gcc/tree.h
> @@ -246,7 +246,7 @@ as_internal_fn (combined_fn code)
>
>  /* When checking is enabled, errors will be generated if a tree node
>     is accessed incorrectly. The macros die with a fatal error.  */
> -#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
> +#ifdef ENABLE_TREE_CHECKING
>
>  #define TREE_CHECK(T, CODE) \
>  (tree_check ((T), __FILE__, __LINE__, __FUNCTION__, (CODE)))
> @@ -2831,16 +2831,12 @@ extern void decl_value_expr_insert (tree, tree);
>  /* The DECL_RTL for NODE, if it is set, or NULL, if it is not set.  */
>  #define DECL_RTL_IF_SET(NODE) (DECL_RTL_SET_P (NODE) ? DECL_RTL (NODE) : NULL)
>
> -#if (GCC_VERSION >= 2007)
>  #define DECL_RTL_KNOWN_SET(decl) __extension__                         \
>  ({  tree const __d = (decl);                                           \
>      gcc_checking_assert (DECL_RTL_SET_P (__d));                                \
>      /* Dereference it so the compiler knows it can't be NULL even      \
>         without assertion checking.  */                                 \
>      &*DECL_RTL_IF_SET (__d); })
> -#else
> -#define DECL_RTL_KNOWN_SET(decl) (&*DECL_RTL_IF_SET (decl))
> -#endif
>
>  /* In VAR_DECL and PARM_DECL nodes, nonzero means declared `register'.  */
>  #define DECL_REGISTER(NODE) (DECL_WRTL_CHECK (NODE)->decl_common.decl_flag_0)
> @@ -3448,7 +3444,7 @@ extern tree build_target_option_node (struct gcc_options *opts,
>
>  extern void prepare_target_option_nodes_for_pch (void);
>
> -#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
> +#ifdef ENABLE_TREE_CHECKING
>
>  inline tree
>  tree_check (tree __t, const char *__f, int __l, const char *__g, tree_code __c)
> @@ -3663,10 +3659,8 @@ tree_int_cst_elt_check (tree __t, int __i,
>
>  /* Workaround -Wstrict-overflow false positive during profiledbootstrap.  */
>
> -# if GCC_VERSION >= 4006
>  #pragma GCC diagnostic push
>  #pragma GCC diagnostic ignored "-Wstrict-overflow"
> -#endif
>
>  inline tree *
>  tree_vec_elt_check (tree __t, int __i,
> @@ -3679,9 +3673,7 @@ tree_vec_elt_check (tree __t, int __i,
>    return &CONST_CAST_TREE (__t)->vec.a[__i];
>  }
>
> -# if GCC_VERSION >= 4006
>  #pragma GCC diagnostic pop
> -#endif
>
>  inline tree *
>  omp_clause_elt_check (tree __t, int __i,
> @@ -3889,10 +3881,8 @@ non_type_check (const_tree __t, const char *__f, int __l, const char *__g)
>    return __t;
>  }
>
> -# if GCC_VERSION >= 4006
>  #pragma GCC diagnostic push
>  #pragma GCC diagnostic ignored "-Wstrict-overflow"
> -#endif
>
>  inline const_tree *
>  tree_vec_elt_check (const_tree __t, int __i,
> @@ -3906,9 +3896,7 @@ tree_vec_elt_check (const_tree __t, int __i,
>    //return &__t->vec.a[__i];
>  }
>
> -# if GCC_VERSION >= 4006
>  #pragma GCC diagnostic pop
> -#endif
>
>  inline const_tree *
>  omp_clause_elt_check (const_tree __t, int __i,
> @@ -3945,7 +3933,7 @@ tree_operand_length (const_tree node)
>      return TREE_CODE_LENGTH (TREE_CODE (node));
>  }
>
> -#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
> +#ifdef ENABLE_TREE_CHECKING
>
>  /* Special checks for TREE_OPERANDs.  */
>  inline tree *
> @@ -4679,7 +4667,7 @@ extern unsigned HOST_WIDE_INT tree_to_uhwi (const_tree)
>    ATTRIBUTE_NONNULL (1) ATTRIBUTE_PURE;
>  extern poly_uint64 tree_to_poly_uint64 (const_tree)
>    ATTRIBUTE_NONNULL (1) ATTRIBUTE_PURE;
> -#if !defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 4003)
> +#ifndef ENABLE_TREE_CHECKING
>  extern inline __attribute__ ((__gnu_inline__)) HOST_WIDE_INT
>  tree_to_shwi (const_tree t)
>  {
> diff --git a/gcc/var-tracking.cc b/gcc/var-tracking.cc
> index 7c3ad0a55bd..2a3a0684e97 100644
> --- a/gcc/var-tracking.cc
> +++ b/gcc/var-tracking.cc
> @@ -404,7 +404,7 @@ int_mem_offset (const_rtx mem)
>    return 0;
>  }
>
> -#if CHECKING_P && (GCC_VERSION >= 2007)
> +#if CHECKING_P
>
>  /* Access VAR's Ith part's offset, checking that it's not a one-part
>     variable.  */
> diff --git a/gcc/vec.h b/gcc/vec.h
> index 3ba7ea7edc2..3cb2772301c 100644
> --- a/gcc/vec.h
> +++ b/gcc/vec.h
> @@ -295,10 +295,8 @@ va_heap::reserve (vec<T, va_heap, vl_embed> *&v, unsigned reserve, bool exact
>  }
>
>
> -#if GCC_VERSION >= 4007
>  #pragma GCC diagnostic push
>  #pragma GCC diagnostic ignored "-Wfree-nonheap-object"
> -#endif
>
>  /* Free the heap space allocated for vector V.  */
>
> @@ -317,9 +315,7 @@ va_heap::release (vec<T, va_heap, vl_embed> *&v)
>    v = NULL;
>  }
>
> -#if GCC_VERSION >= 4007
>  #pragma GCC diagnostic pop
> -#endif
>
>  /* Allocator type for GC vectors.  Notice that we need the structure
>     declaration even if GC is not enabled.  */
> @@ -2349,8 +2345,6 @@ make_array_slice (T *base, unsigned int size)
>    return array_slice<T> (base, size);
>  }
>
> -#if (GCC_VERSION >= 3000)
> -# pragma GCC poison m_vec m_vecpfx m_vecdata
> -#endif
> +#pragma GCC poison m_vec m_vecpfx m_vecdata
>
>  #endif // GCC_VEC_H
> diff --git a/gcc/wide-int.cc b/gcc/wide-int.cc
> index f61b9fefc13..ffd96e6b9d9 100644
> --- a/gcc/wide-int.cc
> +++ b/gcc/wide-int.cc
> @@ -37,7 +37,7 @@ along with GCC; see the file COPYING3.  If not see
>
>  #define W_TYPE_SIZE HOST_BITS_PER_WIDE_INT
>  /* Do not include longlong.h when compiler is clang-based. See PR61146.  */
> -#if GCC_VERSION >= 3000 && (W_TYPE_SIZE == 32 || defined (__SIZEOF_INT128__)) && !defined(__clang__)
> +#if (W_TYPE_SIZE == 32 || defined (__SIZEOF_INT128__)) && !defined(__clang__)
>  typedef unsigned HOST_HALF_WIDE_INT UHWtype;
>  typedef unsigned HOST_WIDE_INT UWtype;
>  typedef unsigned int UQItype __attribute__ ((mode (QI)));
> --
> 2.36.0
>
  
Martin Liška May 5, 2022, 6:50 p.m. UTC | #4
On 5/5/22 20:35, Andrew Pinski wrote:
> GCC_VERSION will be 0 if GCC is not being used.
> So you need to audit these better really.

Ah, I see. So it basically means all the non-GCC conditional
code needs to remain and I can replace
#if GCC_VERSION >= X_Y_Z with #ifdef __GNUC__

Am I correct?
Martin
  
Iain Sandoe May 5, 2022, 6:58 p.m. UTC | #5
> On 5 May 2022, at 19:50, Martin Liška <mliska@suse.cz> wrote:
> 
> On 5/5/22 20:35, Andrew Pinski wrote:
>> GCC_VERSION will be 0 if GCC is not being used.
>> So you need to audit these better really.
> 
> Ah, I see. So it basically means all the non-GCC conditional
> code needs to remain and I can replace
> #if GCC_VERSION >= X_Y_Z with #ifdef __GNUC__

I think several non-GCC compilers define __GNUC__ so that depends on what you intend.
Iain

> 
> Am I correct?
> Martin
  
Richard Biener May 6, 2022, 6:21 a.m. UTC | #6
On Thu, May 5, 2022 at 8:59 PM Iain Sandoe via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
>
>
> > On 5 May 2022, at 19:50, Martin Liška <mliska@suse.cz> wrote:
> >
> > On 5/5/22 20:35, Andrew Pinski wrote:
> >> GCC_VERSION will be 0 if GCC is not being used.
> >> So you need to audit these better really.
> >
> > Ah, I see. So it basically means all the non-GCC conditional
> > code needs to remain and I can replace
> > #if GCC_VERSION >= X_Y_Z with #ifdef __GNUC__
>
> I think several non-GCC compilers define __GNUC__ so that depends on what you intend.

Indeed.  Other compilers are careful in what GCC version they announce
specifically
to match up with its extensions.  They might still support C++11 when
they do not
support all extensions of GCC 4.8.

So I think we should drop this patch.

Richard.

> Iain
>
> >
> > Am I correct?
> > Martin
>
  
Eric Gallager May 12, 2022, 1:45 a.m. UTC | #7
On Thu, May 5, 2022 at 2:26 PM Martin Liška <mliska@suse.cz> wrote:
>
> On 5/5/22 14:24, Richard Biener wrote:
> > Hmm, but we support C++11 host compilers that are not GCC but
> > may claim to be, with GCC_VERSION 4.2.x for example.  Are we sure
> > all those liars implement what we guard with the version checks?
>
> Do you know about any real example of such a liars?
> Why should we even care about them?
>

Well, there's clang, for one (which pretends to be gcc 4.2), which is
kind of a big deal...

> Martin
>
> >
> > I suppose to be "correct" we'd at least need to preserve
> > #if __GNUC__
> > in places where we might use the host compiler?  (if compilers then lie
> > it's their own fault)
>
  

Patch

diff --git a/gcc/bitmap.cc b/gcc/bitmap.cc
index 88c329f9325..a19d8cddea5 100644
--- a/gcc/bitmap.cc
+++ b/gcc/bitmap.cc
@@ -1081,33 +1081,6 @@  bitmap_get_aligned_chunk (const_bitmap head, unsigned int chunk,
   return (ptr->bits[word_num] >> bit_num) & max_value;
 }
 
-#if GCC_VERSION < 3400
-/* Table of number of set bits in a character, indexed by value of char.  */
-static const unsigned char popcount_table[] =
-{
-    0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,
-    1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
-    1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
-    2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
-    1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
-    2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
-    2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
-    3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,4,5,5,6,5,6,6,7,5,6,6,7,6,7,7,8,
-};
-
-static unsigned long
-bitmap_popcount (BITMAP_WORD a)
-{
-  unsigned long ret = 0;
-  unsigned i;
-
-  /* Just do this the table way for now  */
-  for (i = 0; i < BITMAP_WORD_BITS; i+= 8)
-    ret += popcount_table[(a >> i) & 0xff];
-  return ret;
-}
-#endif
-
 /* Count and return the number of bits set in the bitmap word BITS.  */
 static unsigned long
 bitmap_count_bits_in_word (const BITMAP_WORD *bits)
@@ -1116,13 +1089,9 @@  bitmap_count_bits_in_word (const BITMAP_WORD *bits)
 
   for (unsigned ix = 0; ix != BITMAP_ELEMENT_WORDS; ix++)
     {
-#if GCC_VERSION >= 3400
       /* Note that popcountl matches BITMAP_WORD in type, so the actual size
 	 of BITMAP_WORD is not material.  */
       count += __builtin_popcountl (bits[ix]);
-#else
-      count += bitmap_popcount (bits[ix]);
-#endif
     }
   return count;
 }
@@ -1201,13 +1170,9 @@  bitmap_single_bit_set_p (const_bitmap a)
 
   for (ix = 0; ix != BITMAP_ELEMENT_WORDS; ix++)
     {
-#if GCC_VERSION >= 3400
       /* Note that popcountl matches BITMAP_WORD in type, so the actual size
 	 of BITMAP_WORD is not material.  */
       count += __builtin_popcountl (elt->bits[ix]);
-#else
-      count += bitmap_popcount (elt->bits[ix]);
-#endif
       if (count > 1)
 	return false;
     }
@@ -1244,31 +1209,9 @@  bitmap_first_set_bit (const_bitmap a)
  found_bit:
   bit_no += ix * BITMAP_WORD_BITS;
 
-#if GCC_VERSION >= 3004
   gcc_assert (sizeof (long) == sizeof (word));
   bit_no += __builtin_ctzl (word);
-#else
-  /* Binary search for the first set bit.  */
-#if BITMAP_WORD_BITS > 64
-#error "Fill out the table."
-#endif
-#if BITMAP_WORD_BITS > 32
-  if (!(word & 0xffffffff))
-    word >>= 32, bit_no += 32;
-#endif
-  if (!(word & 0xffff))
-    word >>= 16, bit_no += 16;
-  if (!(word & 0xff))
-    word >>= 8, bit_no += 8;
-  if (!(word & 0xf))
-    word >>= 4, bit_no += 4;
-  if (!(word & 0x3))
-    word >>= 2, bit_no += 2;
-  if (!(word & 0x1))
-    word >>= 1, bit_no += 1;
-
- gcc_checking_assert (word & 1);
-#endif
+
  return bit_no;
 }
 
@@ -1302,22 +1245,8 @@  bitmap_last_set_bit (const_bitmap a)
   gcc_assert (elt->bits[ix] != 0);
  found_bit:
   bit_no += ix * BITMAP_WORD_BITS;
-#if GCC_VERSION >= 3004
   gcc_assert (sizeof (long) == sizeof (word));
   bit_no += BITMAP_WORD_BITS - __builtin_clzl (word) - 1;
-#else
-  /* Hopefully this is a twos-complement host...  */
-  BITMAP_WORD x = word;
-  x |= (x >> 1);
-  x |= (x >> 2);
-  x |= (x >> 4);
-  x |= (x >> 8);
-  x |= (x >> 16);
-#if BITMAP_WORD_BITS > 32
-  x |= (x >> 32);
-#endif
-  bit_no += bitmap_popcount (x) - 1;
-#endif
 
   return bit_no;
 }
diff --git a/gcc/bitmap.h b/gcc/bitmap.h
index 7fba443aff1..e7bf67a5474 100644
--- a/gcc/bitmap.h
+++ b/gcc/bitmap.h
@@ -708,20 +708,10 @@  bmp_iter_next (bitmap_iterator *bi, unsigned *bit_no)
 static inline void
 bmp_iter_next_bit (bitmap_iterator * bi, unsigned *bit_no)
 {
-#if (GCC_VERSION >= 3004)
-  {
-    unsigned int n = __builtin_ctzl (bi->bits);
-    gcc_assert (sizeof (unsigned long) == sizeof (BITMAP_WORD));
-    bi->bits >>= n;
-    *bit_no += n;
-  }
-#else
-  while (!(bi->bits & 1))
-    {
-      bi->bits >>= 1;
-      *bit_no += 1;
-    }
-#endif
+  unsigned int n = __builtin_ctzl (bi->bits);
+  gcc_assert (sizeof (unsigned long) == sizeof (BITMAP_WORD));
+  bi->bits >>= n;
+  *bit_no += n;
 }
 
 /* Advance to the next nonzero bit of a single bitmap, we will have
diff --git a/gcc/config/ia64/ia64.cc b/gcc/config/ia64/ia64.cc
index f9fb681a36c..445a391f0f8 100644
--- a/gcc/config/ia64/ia64.cc
+++ b/gcc/config/ia64/ia64.cc
@@ -6213,11 +6213,8 @@  ia64_safe_type (rtx_insn *insn)
    If a predicate register is written by an AND.ORCM we set WRITTEN_BY_AND
    to true; if it was written by an OR.ANDCM we set WRITTEN_BY_OR to true.  */
 
-#if GCC_VERSION >= 4000
 #define RWS_FIELD_TYPE __extension__ unsigned short
-#else
-#define RWS_FIELD_TYPE unsigned int
-#endif
+
 struct reg_write_state
 {
   RWS_FIELD_TYPE write_count : 2;
diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h
index 523256a5c9d..4e83372a291 100644
--- a/gcc/config/rs6000/rs6000.h
+++ b/gcc/config/rs6000/rs6000.h
@@ -2586,9 +2586,7 @@  typedef struct GTY(()) machine_function
 
 #define TARGET_SUPPORTS_WIDE_INT 1
 
-#if (GCC_VERSION >= 3000)
 #pragma GCC poison TARGET_FLOAT128 OPTION_MASK_FLOAT128 MASK_FLOAT128
-#endif
 
 /* Whether a given VALUE is a valid 16 or 34-bit signed integer.  */
 #define SIGNED_INTEGER_NBIT_P(VALUE, N)					\
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 663fe7a20fc..e9c3cf2bad0 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -631,7 +631,7 @@  extern GTY(()) tree cp_global_trees[CPTI_MAX];
 #define BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK(NODE) \
   TREE_CHECK(NODE,BOUND_TEMPLATE_TEMPLATE_PARM)
 
-#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
+#if defined ENABLE_TREE_CHECKING
 
 /* Returns t iff the node can have a TEMPLATE_INFO field.  */
 
@@ -2989,7 +2989,7 @@  struct GTY(()) lang_decl {
 #define STRIP_TEMPLATE(NODE) \
   (TREE_CODE (NODE) == TEMPLATE_DECL ? DECL_TEMPLATE_RESULT (NODE) : NODE)
 
-#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
+#if defined ENABLE_TREE_CHECKING
 
 #define LANG_DECL_MIN_CHECK(NODE) __extension__			\
 ({ struct lang_decl *lt = DECL_LANG_SPECIFIC (NODE);		\
diff --git a/gcc/cp/tree.cc b/gcc/cp/tree.cc
index ed0d0d22950..98175bfeb11 100644
--- a/gcc/cp/tree.cc
+++ b/gcc/cp/tree.cc
@@ -6129,7 +6129,7 @@  cp_tree_c_finish_parsing ()
   deleted_copy_types = NULL;
 }
 
-#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
+#if defined ENABLE_TREE_CHECKING
 /* Complain that some language-specific thing hanging off a tree
    node has been accessed improperly.  */
 
diff --git a/gcc/defaults.h b/gcc/defaults.h
index 7c7a80e596e..fbd4d8e5ae6 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -949,7 +949,7 @@  see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #define DEFAULT_USE_CXA_ATEXIT 0
 #endif
 
-#if GCC_VERSION >= 3000 && defined IN_GCC
+#ifdef IN_GCC
 /* These old constraint macros shouldn't appear anywhere in a
    configuration using MD constraint definitions.  */
 #endif
diff --git a/gcc/diagnostic-core.h b/gcc/diagnostic-core.h
index 286954ac2f8..0df0c896406 100644
--- a/gcc/diagnostic-core.h
+++ b/gcc/diagnostic-core.h
@@ -60,11 +60,7 @@  extern const char *trim_filename (const char *);
 /* None of these functions are suitable for ATTRIBUTE_PRINTF, because
    each language front end can extend them with its own set of format
    specifiers.  We must use custom format checks.  */
-#if (CHECKING_P && GCC_VERSION >= 4001) || GCC_VERSION == BUILDING_GCC_VERSION
 #define ATTRIBUTE_GCC_DIAG(m, n) __attribute__ ((__format__ (GCC_DIAG_STYLE, m, n))) ATTRIBUTE_NONNULL(m)
-#else
-#define ATTRIBUTE_GCC_DIAG(m, n) ATTRIBUTE_NONNULL(m)
-#endif
 extern void internal_error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2)
      ATTRIBUTE_NORETURN;
 extern void internal_error_no_backtrace (const char *, ...)
diff --git a/gcc/dwarf2cfi.cc b/gcc/dwarf2cfi.cc
index ab7c5cc5b27..6aae3bdb5aa 100644
--- a/gcc/dwarf2cfi.cc
+++ b/gcc/dwarf2cfi.cc
@@ -45,9 +45,7 @@  along with GCC; see the file COPYING3.  If not see
    totally replaced in this file; make sure it stays that way.  */
 #undef DWARF2_UNWIND_INFO
 #undef DWARF2_FRAME_INFO
-#if (GCC_VERSION >= 3000)
- #pragma GCC poison DWARF2_UNWIND_INFO DWARF2_FRAME_INFO
-#endif
+#pragma GCC poison DWARF2_UNWIND_INFO DWARF2_FRAME_INFO
 
 #ifndef INCOMING_RETURN_ADDR_RTX
 #define INCOMING_RETURN_ADDR_RTX  (gcc_unreachable (), NULL_RTX)
diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc
index 5681b01749a..d31818f999d 100644
--- a/gcc/dwarf2out.cc
+++ b/gcc/dwarf2out.cc
@@ -133,9 +133,7 @@  int vms_file_stats_name (const char *, long long *, long *, char *, int *);
    totally replaced in this file; make sure it stays that way.  */
 #undef DWARF2_UNWIND_INFO
 #undef DWARF2_FRAME_INFO
-#if (GCC_VERSION >= 3000)
- #pragma GCC poison DWARF2_UNWIND_INFO DWARF2_FRAME_INFO
-#endif
+#pragma GCC poison DWARF2_UNWIND_INFO DWARF2_FRAME_INFO
 
 /* The size of the target's pointer type.  */
 #ifndef PTR_SIZE
@@ -3370,10 +3368,8 @@  bool
 dwarf2out_default_as_loc_support (void)
 {
   return DWARF2_ASM_LINE_DEBUG_INFO;
-#if (GCC_VERSION >= 3000)
-# undef DWARF2_ASM_LINE_DEBUG_INFO
-# pragma GCC poison DWARF2_ASM_LINE_DEBUG_INFO
-#endif
+#undef DWARF2_ASM_LINE_DEBUG_INFO
+#pragma GCC poison DWARF2_ASM_LINE_DEBUG_INFO
 }
 
 /* Return true if GCC configure detected assembler support for views
@@ -3383,10 +3379,8 @@  bool
 dwarf2out_default_as_locview_support (void)
 {
   return DWARF2_ASM_VIEW_DEBUG_INFO;
-#if (GCC_VERSION >= 3000)
-# undef DWARF2_ASM_VIEW_DEBUG_INFO
-# pragma GCC poison DWARF2_ASM_VIEW_DEBUG_INFO
-#endif
+#undef DWARF2_ASM_VIEW_DEBUG_INFO
+#pragma GCC poison DWARF2_ASM_VIEW_DEBUG_INFO
 }
 
 /* A bit is set in ZERO_VIEW_P if we are using the assembler-supported
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index 7bf1d5a0452..7baab4bfceb 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -1072,11 +1072,7 @@  typedef struct
 
 /* In order for the "gfc" format checking to work correctly, you must
    have declared a typedef locus first.  */
-#if GCC_VERSION >= 4001
 #define ATTRIBUTE_GCC_GFC(m, n) __attribute__ ((__format__ (__gcc_gfc__, m, n))) ATTRIBUTE_NONNULL(m)
-#else
-#define ATTRIBUTE_GCC_GFC(m, n) ATTRIBUTE_NONNULL(m)
-#endif
 
 
 /* Suppress error messages or re-enable them.  */
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index bb07cc244e3..c5b92b380b2 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -163,9 +163,7 @@  env_manager::restore ()
 }
 
 /* Forbid other uses of getenv and putenv.  */
-#if (GCC_VERSION >= 3000)
 #pragma GCC poison getenv putenv
-#endif
 
 
 
diff --git a/gcc/genautomata.cc b/gcc/genautomata.cc
index e43314e4ea3..a290122f62c 100644
--- a/gcc/genautomata.cc
+++ b/gcc/genautomata.cc
@@ -879,7 +879,7 @@  struct state_ainsn_table
 /* Macros to access members of unions.  Use only them for access to
    union members of declarations and regexps.  */
 
-#if CHECKING_P && (GCC_VERSION >= 2007)
+#if CHECKING_P
 
 #define DECL_UNIT(d) __extension__					\
 (({ __typeof (d) const _decl = (d);					\
@@ -1070,7 +1070,7 @@  regexp_mode_check_failed (enum regexp_mode mode,
   exit (1);
 }
 
-#else /* #if CHECKING_P && (GCC_VERSION >= 2007) */
+#else /* #if CHECKING_P */
 
 #define DECL_UNIT(d) (&(d)->decl.unit)
 #define DECL_BYPASS(d) (&(d)->decl.bypass)
@@ -1088,7 +1088,7 @@  regexp_mode_check_failed (enum regexp_mode mode,
 #define REGEXP_ALLOF(r) (&(r)->regexp.allof)
 #define REGEXP_ONEOF(r) (&(r)->regexp.oneof)
 
-#endif /* #if CHECKING_P && (GCC_VERSION >= 2007) */
+#endif /* #if CHECKING_P */
 
 #define XCREATENODE(T) ((T *) create_node (sizeof (T)))
 #define XCREATENODEVEC(T, N) ((T *) create_node (sizeof (T) * (N)))
diff --git a/gcc/genconditions.cc b/gcc/genconditions.cc
index f63a3f495c5..8845309fd91 100644
--- a/gcc/genconditions.cc
+++ b/gcc/genconditions.cc
@@ -58,7 +58,6 @@  write_header (void)
 /* It is necessary, but not entirely safe, to include the headers below\n\
    in a generator program.  As a defensive measure, don't do so when the\n\
    table isn't going to have anything in it.  */\n\
-#if GCC_VERSION >= 3001\n\
 \n\
 /* Do not allow checking to confuse the issue.  */\n\
 #undef CHECKING_P\n\
@@ -108,8 +107,7 @@  write_header (void)
 extern rtx_insn *insn;\n\
 extern rtx ins1;\n\
 extern rtx operands[];\n\
-\n\
-#endif /* gcc >= 3.0.1 */\n");
+\n");
 }
 
 /* Write out one entry in the conditions table, using the data pointed
@@ -170,12 +168,11 @@  struct c_test\n\
    vary at run time.  It works in 3.0.1 and later; 3.0 only when not\n\
    optimizing.  */\n\
 \n\
-#if GCC_VERSION >= 3001\n\
 static const struct c_test insn_conditions[] = {\n");
 
   traverse_c_tests (write_one_condition, 0);
 
-  puts ("  { nullptr, -1 }\n};\n#endif /* gcc >= 3.0.1 */\n");
+  puts ("  { nullptr, -1 }\n};\n");
 }
 
 /* Emit code which will convert the C-format table to a
@@ -191,7 +188,6 @@  write_writer (void)
 	"  unsigned int i;\n"
         "  const char *p;\n"
         "  puts (\"(define_conditions [\");\n"
-	"#if GCC_VERSION >= 3001\n"
 	"  for (i = 0; i < ARRAY_SIZE (insn_conditions) - 1; i++)\n"
 	"    {\n"
 	"      printf (\"  (%d \\\"\", insn_conditions[i].value);\n"
@@ -207,7 +203,6 @@  write_writer (void)
 	"        }\n"
         "      puts (\"\\\")\");\n"
         "    }\n"
-	"#endif /* gcc >= 3.0.1 */\n"
 	"  puts (\"])\");\n"
         "  fflush (stdout);\n"
         "return ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE;\n"
diff --git a/gcc/genmatch.cc b/gcc/genmatch.cc
index 2eda7300821..a10a51b0c13 100644
--- a/gcc/genmatch.cc
+++ b/gcc/genmatch.cc
@@ -70,9 +70,7 @@  linemap_client_expand_location_to_spelling_point (location_t loc,
 }
 
 static bool
-#if GCC_VERSION >= 4001
 __attribute__((format (printf, 5, 0)))
-#endif
 diagnostic_cb (cpp_reader *, enum cpp_diagnostic_level errtype,
 	       enum cpp_warning_reason, rich_location *richloc,
 	       const char *msg, va_list *ap)
@@ -115,9 +113,7 @@  notfound:
 }
 
 static void
-#if GCC_VERSION >= 4001
 __attribute__((format (printf, 2, 3)))
-#endif
 fatal_at (const cpp_token *tk, const char *msg, ...)
 {
   rich_location richloc (line_table, tk->src_loc);
@@ -128,9 +124,7 @@  fatal_at (const cpp_token *tk, const char *msg, ...)
 }
 
 static void
-#if GCC_VERSION >= 4001
 __attribute__((format (printf, 2, 3)))
-#endif
 fatal_at (location_t loc, const char *msg, ...)
 {
   rich_location richloc (line_table, loc);
@@ -141,9 +135,7 @@  fatal_at (location_t loc, const char *msg, ...)
 }
 
 static void
-#if GCC_VERSION >= 4001
 __attribute__((format (printf, 2, 3)))
-#endif
 warning_at (const cpp_token *tk, const char *msg, ...)
 {
   rich_location richloc (line_table, tk->src_loc);
@@ -154,9 +146,7 @@  warning_at (const cpp_token *tk, const char *msg, ...)
 }
 
 static void
-#if GCC_VERSION >= 4001
 __attribute__((format (printf, 2, 3)))
-#endif
 warning_at (location_t loc, const char *msg, ...)
 {
   rich_location richloc (line_table, loc);
@@ -169,9 +159,7 @@  warning_at (location_t loc, const char *msg, ...)
 /* Like fprintf, but print INDENT spaces at the beginning.  */
 
 static void
-#if GCC_VERSION >= 4001
 __attribute__((format (printf, 3, 4)))
-#endif
 fprintf_indent (FILE *f, unsigned int indent, const char *format, ...)
 {
   va_list ap;
diff --git a/gcc/genmodes.cc b/gcc/genmodes.cc
index 59850bb070a..0f4d746c157 100644
--- a/gcc/genmodes.cc
+++ b/gcc/genmodes.cc
@@ -1399,13 +1399,13 @@  emit_insn_modes_inline_h (void)
 #ifndef GCC_INSN_MODES_INLINE_H\n\
 #define GCC_INSN_MODES_INLINE_H");
 
-  puts ("\n#if !defined (USED_FOR_TARGET) && GCC_VERSION >= 4001\n");
+  puts ("\n#if !defined (USED_FOR_TARGET)\n");
   emit_mode_size_inline ();
   emit_mode_nunits_inline ();
   emit_mode_inner_inline ();
   emit_mode_unit_size_inline ();
   emit_mode_unit_precision_inline ();
-  puts ("#endif /* GCC_VERSION >= 4001 */");
+  puts ("#endif");
 
   puts ("\
 \n\
diff --git a/gcc/genoutput.cc b/gcc/genoutput.cc
index 6bb03e2864f..853bec0201d 100644
--- a/gcc/genoutput.cc
+++ b/gcc/genoutput.cc
@@ -291,7 +291,7 @@  output_insn_data (void)
 	break;
       }
 
-  printf ("#if GCC_VERSION >= 2007\n__extension__\n#endif\n");
+  printf ("\n__extension__\n");
   printf ("\nconst struct insn_data_d insn_data[] = \n{\n");
 
   for (d = idata; d; d = d->next)
diff --git a/gcc/ggc-page.cc b/gcc/ggc-page.cc
index 7a7a1b0901f..8fe07b80066 100644
--- a/gcc/ggc-page.cc
+++ b/gcc/ggc-page.cc
@@ -568,11 +568,7 @@  push_by_depth (page_entry *p, unsigned long *s)
   G.save_in_use[G.by_depth_in_use++] = s;
 }
 
-#if (GCC_VERSION < 3001)
-#define prefetch(X) ((void) X)
-#else
 #define prefetch(X) __builtin_prefetch (X)
-#endif
 
 #define save_in_use_p_i(__i) \
   (G.save_in_use[__i])
@@ -1340,12 +1336,7 @@  ggc_internal_alloc (size_t size, void (*f)(void *), size_t s, size_t n
 	  while (~entry->in_use_p[word] == 0)
 	    ++word;
 
-#if GCC_VERSION >= 3004
 	  bit = __builtin_ctzl (~entry->in_use_p[word]);
-#else
-	  while ((entry->in_use_p[word] >> bit) & 1)
-	    ++bit;
-#endif
 
 	  hint = word * HOST_BITS_PER_LONG + bit;
 	}
diff --git a/gcc/ggc-tests.cc b/gcc/ggc-tests.cc
index 620989489b6..d028da339e6 100644
--- a/gcc/ggc-tests.cc
+++ b/gcc/ggc-tests.cc
@@ -180,10 +180,8 @@  int test_struct_with_dtor::dtor_call_count;
 static void
 test_finalization ()
 {
-#if GCC_VERSION >= 4003
   ASSERT_FALSE (need_finalization_p <test_struct> ());
   ASSERT_TRUE (need_finalization_p <test_struct_with_dtor> ());
-#endif
 
   /* Create some garbage.  */
   const int count = 10;
diff --git a/gcc/ggc.h b/gcc/ggc.h
index aeec1bafb9b..0f72f368a72 100644
--- a/gcc/ggc.h
+++ b/gcc/ggc.h
@@ -170,11 +170,7 @@  template<typename T>
 inline bool
 need_finalization_p ()
 {
-#if GCC_VERSION >= 4003
   return !__has_trivial_destructor (T);
-#else
-  return true;
-#endif
 }
 
 template<typename T>
diff --git a/gcc/hwint.cc b/gcc/hwint.cc
index e53e0bf7906..fa2df400842 100644
--- a/gcc/hwint.cc
+++ b/gcc/hwint.cc
@@ -21,110 +21,6 @@  along with GCC; see the file COPYING3.  If not see
 #include "system.h"
 #include "coretypes.h"
 
-#if GCC_VERSION < 3004
-
-/* The functions clz_hwi, ctz_hwi, ffs_hwi, floor_log2, ceil_log2,
-   and exact_log2 are defined as inline functions in hwint.h
-   if GCC_VERSION >= 3004.
-   The definitions here are used for older versions of GCC and
-   non-GCC bootstrap compilers.  */
-
-/* Given X, an unsigned number, return the largest int Y such that 2**Y <= X.
-   If X is 0, return -1.  */
-
-int
-floor_log2 (unsigned HOST_WIDE_INT x)
-{
-  int t = 0;
-
-  if (x == 0)
-    return -1;
-
-  if (HOST_BITS_PER_WIDE_INT > 64)
-    if (x >= HOST_WIDE_INT_1U << (t + 64))
-      t += 64;
-  if (HOST_BITS_PER_WIDE_INT > 32)
-    if (x >= HOST_WIDE_INT_1U << (t + 32))
-      t += 32;
-  if (x >= HOST_WIDE_INT_1U << (t + 16))
-    t += 16;
-  if (x >= HOST_WIDE_INT_1U << (t + 8))
-    t += 8;
-  if (x >= HOST_WIDE_INT_1U << (t + 4))
-    t += 4;
-  if (x >= HOST_WIDE_INT_1U << (t + 2))
-    t += 2;
-  if (x >= HOST_WIDE_INT_1U << (t + 1))
-    t += 1;
-
-  return t;
-}
-
-/* Given X, an unsigned number, return the least Y such that 2**Y >= X.  */
-
-int
-ceil_log2 (unsigned HOST_WIDE_INT x)
-{
-  return x == 0 ? 0 : floor_log2 (x - 1) + 1;
-}
-
-/* Return the logarithm of X, base 2, considering X unsigned,
-   if X is a power of 2.  Otherwise, returns -1.  */
-
-int
-exact_log2 (unsigned HOST_WIDE_INT x)
-{
-  if (!pow2p_hwi (x))
-    return -1;
-  return floor_log2 (x);
-}
-
-/* Given X, an unsigned number, return the number of least significant bits
-   that are zero.  When X == 0, the result is the word size.  */
-
-int
-ctz_hwi (unsigned HOST_WIDE_INT x)
-{
-  return x ? floor_log2 (least_bit_hwi (x)) : HOST_BITS_PER_WIDE_INT;
-}
-
-/* Similarly for most significant bits.  */
-
-int
-clz_hwi (unsigned HOST_WIDE_INT x)
-{
-  return HOST_BITS_PER_WIDE_INT - 1 - floor_log2 (x);
-}
-
-/* Similar to ctz_hwi, except that the least significant bit is numbered
-   starting from 1, and X == 0 yields 0.  */
-
-int
-ffs_hwi (unsigned HOST_WIDE_INT x)
-{
-  return 1 + floor_log2 (least_bit_hwi (x));
-}
-
-/* Return the number of set bits in X.  */
-
-int
-popcount_hwi (unsigned HOST_WIDE_INT x)
-{
-  int i, ret = 0;
-  size_t bits = sizeof (x) * CHAR_BIT;
-
-  for (i = 0; i < bits; i += 1)
-    {
-      ret += x & 1;
-      x >>= 1;
-    }
-
-  return ret;
-}
-
-#endif /* GCC_VERSION < 3004 */
-
-
 /* Compute the greatest common divisor of two numbers A and B using
    Euclid's algorithm.  */
 
diff --git a/gcc/hwint.h b/gcc/hwint.h
index c160bea0cb2..f3b5a779a65 100644
--- a/gcc/hwint.h
+++ b/gcc/hwint.h
@@ -28,18 +28,16 @@ 
 #define HOST_LONG_LONG_FORMAT "ll"
 #endif
 
-/* If HAVE_LONG_LONG and SIZEOF_LONG_LONG aren't defined, but
-   GCC_VERSION >= 3000, assume this is the second or later stage of a
+/* If HAVE_LONG_LONG and SIZEOF_LONG_LONG aren't defined
+   assume this is the second or later stage of a
    bootstrap, we do have long long, and it's 64 bits.  (This is
    required by C99; we do have some ports that violate that assumption
    but they're all cross-compile-only.)  Just in case, force a
    constraint violation if that assumption is incorrect.  */
 #if !defined HAVE_LONG_LONG
-# if GCC_VERSION >= 3000
-#  define HAVE_LONG_LONG 1
-#  define SIZEOF_LONG_LONG 8
+# define HAVE_LONG_LONG 1
+# define SIZEOF_LONG_LONG 8
 extern char sizeof_long_long_must_be_8[sizeof (long long) == 8 ? 1 : -1];
-# endif
 #endif
 
 #ifdef HAVE_LONG_LONG
@@ -160,26 +158,6 @@  pow2p_hwi (unsigned HOST_WIDE_INT x)
   return x && pow2_or_zerop (x);
 }
 
-#if GCC_VERSION < 3004
-
-extern int clz_hwi (unsigned HOST_WIDE_INT x);
-extern int ctz_hwi (unsigned HOST_WIDE_INT x);
-extern int ffs_hwi (unsigned HOST_WIDE_INT x);
-
-/* Return the number of set bits in X.  */
-extern int popcount_hwi (unsigned HOST_WIDE_INT x);
-
-/* Return log2, or -1 if not exact.  */
-extern int exact_log2                  (unsigned HOST_WIDE_INT);
-
-/* Return floor of log2, with -1 for zero.  */
-extern int floor_log2                  (unsigned HOST_WIDE_INT);
-
-/* Return the smallest n such that 2**n >= X.  */
-extern int ceil_log2			(unsigned HOST_WIDE_INT);
-
-#else /* GCC_VERSION >= 3004 */
-
 /* For convenience, define 0 -> word_size.  */
 static inline int
 clz_hwi (unsigned HOST_WIDE_INT x)
@@ -251,8 +229,6 @@  exact_log2 (unsigned HOST_WIDE_INT x)
   return pow2p_hwi (x) ? ctz_hwi (x) : -1;
 }
 
-#endif /* GCC_VERSION >= 3004 */
-
 #define HOST_WIDE_INT_MIN (HOST_WIDE_INT) \
   (HOST_WIDE_INT_1U << (HOST_BITS_PER_WIDE_INT - 1))
 #define HOST_WIDE_INT_MAX (~(HOST_WIDE_INT_MIN))
diff --git a/gcc/ira-int.h b/gcc/ira-int.h
index f42a314fa7f..76ce6b4d75c 100644
--- a/gcc/ira-int.h
+++ b/gcc/ira-int.h
@@ -151,7 +151,7 @@  extern int ira_loop_tree_height;
 extern ira_loop_tree_node_t ira_bb_nodes;
 
 /* Two access macros to the nodes representing basic blocks.  */
-#if defined ENABLE_IRA_CHECKING && (GCC_VERSION >= 2007)
+#ifdef ENABLE_IRA_CHECKING
 #define IRA_BB_NODE_BY_INDEX(index) __extension__			\
 (({ ira_loop_tree_node_t _node = (&ira_bb_nodes[index]);		\
      if (_node->children != NULL || _node->loop != NULL || _node->bb == NULL)\
@@ -173,7 +173,7 @@  extern ira_loop_tree_node_t ira_bb_nodes;
 extern ira_loop_tree_node_t ira_loop_nodes;
 
 /* Two access macros to the nodes representing loops.  */
-#if defined ENABLE_IRA_CHECKING && (GCC_VERSION >= 2007)
+#ifdef ENABLE_IRA_CHECKING
 #define IRA_LOOP_NODE_BY_INDEX(index) __extension__			\
 (({ ira_loop_tree_node_t const _node = (&ira_loop_nodes[index]);	\
      if (_node->children == NULL || _node->bb != NULL			\
@@ -655,7 +655,7 @@  extern int ira_move_loops_num, ira_additional_jumps_num;
 /* Set, clear or test bit number I in R, a bit vector of elements with
    minimal index and maximal index equal correspondingly to MIN and
    MAX.  */
-#if defined ENABLE_IRA_CHECKING && (GCC_VERSION >= 2007)
+#ifdef ENABLE_IRA_CHECKING
 
 #define SET_MINMAX_SET_BIT(R, I, MIN, MAX) __extension__	        \
   (({ int _min = (MIN), _max = (MAX), _i = (I);				\
diff --git a/gcc/jit/jit-common.h b/gcc/jit/jit-common.h
index 3ff7447fbf3..773a2d8df43 100644
--- a/gcc/jit/jit-common.h
+++ b/gcc/jit/jit-common.h
@@ -29,11 +29,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "tree-iterator.h"
 
 #ifdef GCC_VERSION
-#if GCC_VERSION >= 4001
 #define GNU_PRINTF(M, N) __attribute__ ((format (gnu_printf, (M), (N))))
-#else
-#define GNU_PRINTF(M, N)
-#endif
 #endif
 
 const int NUM_GCC_JIT_TYPES = GCC_JIT_TYPE_INT128_T + 1;
diff --git a/gcc/machmode.h b/gcc/machmode.h
index 45df720df73..d84bdd5797d 100644
--- a/gcc/machmode.h
+++ b/gcc/machmode.h
@@ -545,12 +545,8 @@  complex_mode::includes_p (machine_mode m)
 ALWAYS_INLINE poly_uint16
 mode_to_bytes (machine_mode mode)
 {
-#if GCC_VERSION >= 4001
   return (__builtin_constant_p (mode)
 	  ? mode_size_inline (mode) : mode_size[mode]);
-#else
-  return mode_size[mode];
-#endif
 }
 
 /* Return the base GET_MODE_BITSIZE value for MODE.  */
@@ -574,13 +570,9 @@  mode_to_precision (machine_mode mode)
 ALWAYS_INLINE scalar_mode
 mode_to_inner (machine_mode mode)
 {
-#if GCC_VERSION >= 4001
   return scalar_mode::from_int (__builtin_constant_p (mode)
 				? mode_inner_inline (mode)
 				: mode_inner[mode]);
-#else
-  return scalar_mode::from_int (mode_inner[mode]);
-#endif
 }
 
 /* Return the base GET_MODE_UNIT_SIZE value for MODE.  */
@@ -588,12 +580,8 @@  mode_to_inner (machine_mode mode)
 ALWAYS_INLINE unsigned char
 mode_to_unit_size (machine_mode mode)
 {
-#if GCC_VERSION >= 4001
   return (__builtin_constant_p (mode)
 	  ? mode_unit_size_inline (mode) : mode_unit_size[mode]);
-#else
-  return mode_unit_size[mode];
-#endif
 }
 
 /* Return the base GET_MODE_UNIT_PRECISION value for MODE.  */
@@ -601,12 +589,8 @@  mode_to_unit_size (machine_mode mode)
 ALWAYS_INLINE unsigned short
 mode_to_unit_precision (machine_mode mode)
 {
-#if GCC_VERSION >= 4001
   return (__builtin_constant_p (mode)
 	  ? mode_unit_precision_inline (mode) : mode_unit_precision[mode]);
-#else
-  return mode_unit_precision[mode];
-#endif
 }
 
 /* Return the base GET_MODE_NUNITS value for MODE.  */
@@ -614,12 +598,8 @@  mode_to_unit_precision (machine_mode mode)
 ALWAYS_INLINE poly_uint16
 mode_to_nunits (machine_mode mode)
 {
-#if GCC_VERSION >= 4001
   return (__builtin_constant_p (mode)
 	  ? mode_nunits_inline (mode) : mode_nunits[mode]);
-#else
-  return mode_nunits[mode];
-#endif
 }
 
 /* Get the size in bytes of an object of mode MODE.  */
diff --git a/gcc/output.h b/gcc/output.h
index 6dea630913a..2fce8b5c19f 100644
--- a/gcc/output.h
+++ b/gcc/output.h
@@ -115,11 +115,7 @@  extern void output_addr_const (FILE *, rtx);
 
 /* Output a string of assembler code, substituting numbers, strings
    and fixed syntactic prefixes.  */
-#if GCC_VERSION >= 3004
 #define ATTRIBUTE_ASM_FPRINTF(m, n) __attribute__ ((__format__ (__asm_fprintf__, m, n))) ATTRIBUTE_NONNULL(m)
-#else
-#define ATTRIBUTE_ASM_FPRINTF(m, n) ATTRIBUTE_NONNULL(m)
-#endif
 
 extern void fprint_whex (FILE *, unsigned HOST_WIDE_INT);
 extern void fprint_ul (FILE *, unsigned long);
diff --git a/gcc/pretty-print.h b/gcc/pretty-print.h
index fc588447460..425ae339ae0 100644
--- a/gcc/pretty-print.h
+++ b/gcc/pretty-print.h
@@ -374,11 +374,7 @@  extern void pp_separate_with (pretty_printer *, char);
 
 /* This header may be included before diagnostics-core.h, hence the duplicate
    definitions to allow for GCC-specific formats.  */
-#if GCC_VERSION >= 3005
 #define ATTRIBUTE_GCC_PPDIAG(m, n) __attribute__ ((__format__ (GCC_PPDIAG_STYLE, m ,n))) ATTRIBUTE_NONNULL(m)
-#else
-#define ATTRIBUTE_GCC_PPDIAG(m, n) ATTRIBUTE_NONNULL(m)
-#endif
 extern void pp_printf (pretty_printer *, const char *, ...)
      ATTRIBUTE_GCC_PPDIAG(2,3);
 
diff --git a/gcc/rtl.cc b/gcc/rtl.cc
index 86c322b19ca..74be7342803 100644
--- a/gcc/rtl.cc
+++ b/gcc/rtl.cc
@@ -869,7 +869,7 @@  dump_rtx_statistics (void)
   fprintf (stderr, "-----------------------------------------------\n");
 }
 
-#if defined ENABLE_RTL_CHECKING && (GCC_VERSION >= 2007)
+#ifdef ENABLE_RTL_CHECKING
 
 /* Disable warnings about missing quoting in GCC diagnostics for
    the internal_error calls.  Their format strings deliberately don't
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 488016bb42a..5e77be2f024 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -1076,7 +1076,7 @@  is_a_helper <rtx_note *>::test (rtx_insn *insn)
 
 /* General accessor macros for accessing the fields of an rtx.  */
 
-#if defined ENABLE_RTL_CHECKING && (GCC_VERSION >= 2007)
+#if defined ENABLE_RTL_CHECKING
 /* The bit with a star outside the statement expr and an & inside is
    so that N can be evaluated only once.  */
 #define RTL_CHECK1(RTX, N, C1) __extension__				\
@@ -1257,7 +1257,7 @@  extern void rtvec_check_failed_bounds (const_rtvec, int, const char *, int,
 /* Access an individual rtx flag, with no checking of any kind.  */
 #define RTX_FLAG(RTX, FLAG)	((RTX)->FLAG)
 
-#if defined ENABLE_RTL_FLAG_CHECKING && (GCC_VERSION >= 2007)
+#if defined ENABLE_RTL_FLAG_CHECKING
 #define RTL_FLAG_CHECK1(NAME, RTX, C1) __extension__			\
 ({ __typeof (RTX) const _rtx = (RTX);					\
    if (GET_CODE (_rtx) != C1)						\
@@ -1823,7 +1823,7 @@  enum label_kind
   LABEL_WEAK_ENTRY	/* alternate entry point, exported as weak symbol */
 };
 
-#if defined ENABLE_RTL_FLAG_CHECKING && (GCC_VERSION > 2007)
+#if defined ENABLE_RTL_FLAG_CHECKING
 
 /* Retrieve the kind of LABEL.  */
 #define LABEL_KIND(LABEL) __extension__					\
diff --git a/gcc/sbitmap.cc b/gcc/sbitmap.cc
index 5ac2b6d0f67..0a6fddadab8 100644
--- a/gcc/sbitmap.cc
+++ b/gcc/sbitmap.cc
@@ -375,33 +375,6 @@  bitmap_bit_in_range_p (const_sbitmap bmap, unsigned int start, unsigned int end)
   return (bmap->elms[start_word] & mask) != 0;
 }
 
-#if GCC_VERSION < 3400
-/* Table of number of set bits in a character, indexed by value of char.  */
-static const unsigned char popcount_table[] =
-{
-    0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,
-    1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
-    1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
-    2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
-    1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
-    2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
-    2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
-    3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,4,5,5,6,5,6,6,7,5,6,6,7,6,7,7,8,
-};
-
-static unsigned long
-sbitmap_popcount (SBITMAP_ELT_TYPE a)
-{
-  unsigned long ret = 0;
-  unsigned i;
-
-  /* Just do this the table way for now  */
-  for (i = 0; i < HOST_BITS_PER_WIDEST_FAST_INT; i += 8)
-    ret += popcount_table[(a >> i) & 0xff];
-  return ret;
-}
-#endif
-
 /* Count and return the number of bits set in the bitmap BMAP.  */
 
 unsigned int
@@ -411,16 +384,12 @@  bitmap_count_bits (const_sbitmap bmap)
   for (unsigned int i = 0; i < bmap->size; i++)
     if (bmap->elms[i])
       {
-#if GCC_VERSION < 3400
-	count += sbitmap_popcount (bmap->elms[i]);
-#else
-# if HOST_BITS_PER_WIDEST_FAST_INT == HOST_BITS_PER_LONG
+#if HOST_BITS_PER_WIDEST_FAST_INT == HOST_BITS_PER_LONG
 	count += __builtin_popcountl (bmap->elms[i]);
-# elif HOST_BITS_PER_WIDEST_FAST_INT == HOST_BITS_PER_LONGLONG
+#elif HOST_BITS_PER_WIDEST_FAST_INT == HOST_BITS_PER_LONGLONG
 	count += __builtin_popcountll (bmap->elms[i]);
-# else
+#else
 	count += __builtin_popcount (bmap->elms[i]);
-# endif
 #endif
       }
   return count;
diff --git a/gcc/stringpool.h b/gcc/stringpool.h
index 5e301c6011b..b43110cc7a0 100644
--- a/gcc/stringpool.h
+++ b/gcc/stringpool.h
@@ -33,11 +33,9 @@  extern tree maybe_get_identifier (const char *);
    known.  */
 extern tree get_identifier_with_length (const char *, size_t);
 
-#if GCC_VERSION >= 3000
 #define get_identifier(str) \
   (__builtin_constant_p (str)				\
     ? get_identifier_with_length ((str), strlen (str))  \
     : get_identifier (str))
-#endif
 
 #endif  // GCC_STRINGPOOL_H
diff --git a/gcc/system.h b/gcc/system.h
index c5562cc49a3..1688b763ef5 100644
--- a/gcc/system.h
+++ b/gcc/system.h
@@ -596,17 +596,15 @@  extern int vsnprintf (char *, size_t, const char *, va_list);
 #ifdef __cplusplus
 #define HAVE_DESIGNATED_INITIALIZERS 0
 #else
-#define HAVE_DESIGNATED_INITIALIZERS \
-  ((GCC_VERSION >= 2007) || (__STDC_VERSION__ >= 199901L))
+#define HAVE_DESIGNATED_INITIALIZERS 1
 #endif
 #endif
 
 #if !defined(HAVE_DESIGNATED_UNION_INITIALIZERS)
 #ifdef __cplusplus
-#define HAVE_DESIGNATED_UNION_INITIALIZERS (GCC_VERSION >= 4007)
+#define HAVE_DESIGNATED_UNION_INITIALIZERS 1
 #else
-#define HAVE_DESIGNATED_UNION_INITIALIZERS \
-  ((GCC_VERSION >= 2007) || (__STDC_VERSION__ >= 199901L))
+#define HAVE_DESIGNATED_UNION_INITIALIZERS 1
 #endif
 #endif
 
@@ -722,20 +720,6 @@  extern int vsnprintf (char *, size_t, const char *, va_list);
 #define offsetof(TYPE, MEMBER)	((size_t) &((TYPE *) 0)->MEMBER)
 #endif
 
-/* Various error reporting routines want to use __FUNCTION__.  */
-#if (GCC_VERSION < 2007)
-#ifndef __FUNCTION__
-#define __FUNCTION__ "?"
-#endif /* ! __FUNCTION__ */
-#endif
-
-/* __builtin_expect(A, B) evaluates to A, but notifies the compiler that
-   the most likely value of A is B.  This feature was added at some point
-   between 2.95 and 3.0.  Let's use 3.0 as the lower bound for now.  */
-#if (GCC_VERSION < 3000)
-#define __builtin_expect(a, b) (a)
-#endif
-
 /* Some of the headers included by <memory> can use "abort" within a
    namespace, e.g. "_VSTD::abort();", which fails after we use the
    preprocessor to redefine "abort" as "fancy_abort" below.  */
@@ -781,12 +765,9 @@  extern void fancy_abort (const char *, int, const char *)
 #if ENABLE_ASSERT_CHECKING
 #define gcc_assert(EXPR) 						\
    ((void)(!(EXPR) ? fancy_abort (__FILE__, __LINE__, __FUNCTION__), 0 : 0))
-#elif (GCC_VERSION >= 4005)
+#else
 #define gcc_assert(EXPR) 						\
   ((void)(__builtin_expect (!(EXPR), 0) ? __builtin_unreachable (), 0 : 0))
-#else
-/* Include EXPR, so that unused variable warnings do not occur.  */
-#define gcc_assert(EXPR) ((void)(0 && (EXPR)))
 #endif
 
 #if CHECKING_P
@@ -796,21 +777,13 @@  extern void fancy_abort (const char *, int, const char *)
 #define gcc_checking_assert(EXPR) ((void)(0 && (EXPR)))
 #endif
 
-#if GCC_VERSION >= 4000
 #define ALWAYS_INLINE inline __attribute__ ((always_inline))
-#else
-#define ALWAYS_INLINE inline
-#endif
 
-#if GCC_VERSION >= 3004
 #define WARN_UNUSED_RESULT __attribute__ ((__warn_unused_result__))
-#else
-#define WARN_UNUSED_RESULT
-#endif
 
 /* Use gcc_unreachable() to mark unreachable locations (like an
    unreachable default case of a switch.  Do not use gcc_assert(0).  */
-#if (GCC_VERSION >= 4005) && !ENABLE_ASSERT_CHECKING
+#if !ENABLE_ASSERT_CHECKING
 #define gcc_unreachable() __builtin_unreachable ()
 #else
 #define gcc_unreachable() (fancy_abort (__FILE__, __LINE__, __FUNCTION__))
@@ -826,11 +799,7 @@  extern void fancy_abort (const char *, int, const char *)
 # define gcc_fallthrough()
 #endif
 
-#if GCC_VERSION >= 3001
 #define STATIC_CONSTANT_P(X) (__builtin_constant_p (X) && (X))
-#else
-#define STATIC_CONSTANT_P(X) (false && (X))
-#endif
 
 /* static_assert (COND, MESSAGE) is available in C++11 onwards.  */
 #if __cplusplus >= 201103L
@@ -871,12 +840,6 @@  extern void fancy_abort (const char *, int, const char *)
 /* Some compilers do not allow the use of unsigned char in bitfields.  */
 #define BOOL_BITFIELD unsigned int
 
-/* GCC older than 4.4 have broken C++ value initialization handling, see
-   PR11309, PR30111, PR33916, PR82939 and PR84405 for more details.  */
-#if GCC_VERSION > 0 && GCC_VERSION < 4004 && !defined(__clang__)
-# define BROKEN_VALUE_INITIALIZATION
-#endif
-
 /* As the last action in this file, we poison the identifiers that
    shouldn't be used.  Note, luckily gcc-3.0's token-based integrated
    preprocessor won't trip on poisoned identifiers that arrive from
@@ -899,8 +862,6 @@  extern void fancy_abort (const char *, int, const char *)
 #define realloc xrealloc
 #endif
 
-#if (GCC_VERSION >= 3000)
-
 /* Note autoconf checks for prototype declarations and includes
    system.h while doing so.  Only poison these tokens if actually
    compiling gcc, so that the autoconf declaration tests for malloc
@@ -1130,8 +1091,6 @@  extern void fancy_abort (const char *, int, const char *)
    'if (flag_checking)', or with CHECKING_P macro.  */
 #pragma GCC poison ENABLE_CHECKING
 
-#endif /* GCC >= 3.0 */
-
 /* This macro allows casting away const-ness to pass -Wcast-qual
    warnings.  DO NOT USE THIS UNLESS YOU REALLY HAVE TO!  It should
    only be used in certain specific cases.  One valid case is where
@@ -1151,7 +1110,7 @@  extern void fancy_abort (const char *, int, const char *)
 #ifdef __cplusplus
 #define CONST_CAST2(TOTYPE,FROMTYPE,X) (const_cast<TOTYPE> (X))
 #else
-#if defined(__GNUC__) && GCC_VERSION > 4000
+#ifdef __GNUC__
 /* GCC 4.0.x has a bug where it may ICE on this expression,
    so does GCC 3.4.x (PR17436).  */
 #define CONST_CAST2(TOTYPE,FROMTYPE,X) ((__extension__(union {FROMTYPE _q; TOTYPE _nq;})(X))._nq)
@@ -1182,13 +1141,9 @@  helper_const_non_const_cast (const char *p)
 
 /* Activate certain diagnostics as warnings (not errors via the
    -Werror flag).  */
-#if GCC_VERSION >= 4003
-/* If asserts are disabled, activate -Wuninitialized as a warning (not
-   an error/-Werror).  */
 #ifndef ENABLE_ASSERT_CHECKING
 #pragma GCC diagnostic warning "-Wuninitialized"
 #endif
-#endif
 
 #ifdef ENABLE_VALGRIND_ANNOTATIONS
 # ifdef HAVE_VALGRIND_MEMCHECK_H
@@ -1229,13 +1184,8 @@  helper_const_non_const_cast (const char *p)
 
 /* In LTO -fwhole-program build we still want to keep the debug functions available
    for debugger.  Mark them as used to prevent removal.  */
-#if (GCC_VERSION > 4000)
 #define DEBUG_FUNCTION __attribute__ ((__used__))
 #define DEBUG_VARIABLE __attribute__ ((__used__))
-#else
-#define DEBUG_FUNCTION
-#define DEBUG_VARIABLE
-#endif
 
 /* General macro to extract bit Y of X.  */
 #define TEST_BIT(X, Y) (((X) >> (Y)) & 1)
diff --git a/gcc/tree-vrp.cc b/gcc/tree-vrp.cc
index 0cbd9d369ca..436fafcaa0f 100644
--- a/gcc/tree-vrp.cc
+++ b/gcc/tree-vrp.cc
@@ -2955,12 +2955,7 @@  vrp_asserts::find_switch_asserts (basic_block bb, gswitch *last)
   edge e;
   struct case_info *ci;
   size_t n = gimple_switch_num_labels (last);
-#if GCC_VERSION >= 4000
   unsigned int idx;
-#else
-  /* Work around GCC 3.4 bug (PR 37086).  */
-  volatile unsigned int idx;
-#endif
 
   bsi = gsi_for_stmt (last);
   op = gimple_switch_index (last);
diff --git a/gcc/tree.cc b/gcc/tree.cc
index 5e8876d2b38..22df459c53e 100644
--- a/gcc/tree.cc
+++ b/gcc/tree.cc
@@ -8771,7 +8771,7 @@  get_file_function_name (const char *type)
   return get_identifier (buf);
 }
 
-#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
+#ifdef ENABLE_TREE_CHECKING
 
 /* Complain that the tree code of NODE does not match the expected 0
    terminated list of trailing codes. The trailing code list can be
diff --git a/gcc/tree.h b/gcc/tree.h
index 82eb8ba39d2..c53d34f6a47 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -246,7 +246,7 @@  as_internal_fn (combined_fn code)
 
 /* When checking is enabled, errors will be generated if a tree node
    is accessed incorrectly. The macros die with a fatal error.  */
-#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
+#ifdef ENABLE_TREE_CHECKING
 
 #define TREE_CHECK(T, CODE) \
 (tree_check ((T), __FILE__, __LINE__, __FUNCTION__, (CODE)))
@@ -2831,16 +2831,12 @@  extern void decl_value_expr_insert (tree, tree);
 /* The DECL_RTL for NODE, if it is set, or NULL, if it is not set.  */
 #define DECL_RTL_IF_SET(NODE) (DECL_RTL_SET_P (NODE) ? DECL_RTL (NODE) : NULL)
 
-#if (GCC_VERSION >= 2007)
 #define DECL_RTL_KNOWN_SET(decl) __extension__				\
 ({  tree const __d = (decl);						\
     gcc_checking_assert (DECL_RTL_SET_P (__d));				\
     /* Dereference it so the compiler knows it can't be NULL even	\
        without assertion checking.  */					\
     &*DECL_RTL_IF_SET (__d); })
-#else
-#define DECL_RTL_KNOWN_SET(decl) (&*DECL_RTL_IF_SET (decl))
-#endif
 
 /* In VAR_DECL and PARM_DECL nodes, nonzero means declared `register'.  */
 #define DECL_REGISTER(NODE) (DECL_WRTL_CHECK (NODE)->decl_common.decl_flag_0)
@@ -3448,7 +3444,7 @@  extern tree build_target_option_node (struct gcc_options *opts,
 
 extern void prepare_target_option_nodes_for_pch (void);
 
-#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
+#ifdef ENABLE_TREE_CHECKING
 
 inline tree
 tree_check (tree __t, const char *__f, int __l, const char *__g, tree_code __c)
@@ -3663,10 +3659,8 @@  tree_int_cst_elt_check (tree __t, int __i,
 
 /* Workaround -Wstrict-overflow false positive during profiledbootstrap.  */
 
-# if GCC_VERSION >= 4006
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wstrict-overflow"
-#endif
 
 inline tree *
 tree_vec_elt_check (tree __t, int __i,
@@ -3679,9 +3673,7 @@  tree_vec_elt_check (tree __t, int __i,
   return &CONST_CAST_TREE (__t)->vec.a[__i];
 }
 
-# if GCC_VERSION >= 4006
 #pragma GCC diagnostic pop
-#endif
 
 inline tree *
 omp_clause_elt_check (tree __t, int __i,
@@ -3889,10 +3881,8 @@  non_type_check (const_tree __t, const char *__f, int __l, const char *__g)
   return __t;
 }
 
-# if GCC_VERSION >= 4006
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wstrict-overflow"
-#endif
 
 inline const_tree *
 tree_vec_elt_check (const_tree __t, int __i,
@@ -3906,9 +3896,7 @@  tree_vec_elt_check (const_tree __t, int __i,
   //return &__t->vec.a[__i];
 }
 
-# if GCC_VERSION >= 4006
 #pragma GCC diagnostic pop
-#endif
 
 inline const_tree *
 omp_clause_elt_check (const_tree __t, int __i,
@@ -3945,7 +3933,7 @@  tree_operand_length (const_tree node)
     return TREE_CODE_LENGTH (TREE_CODE (node));
 }
 
-#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
+#ifdef ENABLE_TREE_CHECKING
 
 /* Special checks for TREE_OPERANDs.  */
 inline tree *
@@ -4679,7 +4667,7 @@  extern unsigned HOST_WIDE_INT tree_to_uhwi (const_tree)
   ATTRIBUTE_NONNULL (1) ATTRIBUTE_PURE;
 extern poly_uint64 tree_to_poly_uint64 (const_tree)
   ATTRIBUTE_NONNULL (1) ATTRIBUTE_PURE;
-#if !defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 4003)
+#ifndef ENABLE_TREE_CHECKING
 extern inline __attribute__ ((__gnu_inline__)) HOST_WIDE_INT
 tree_to_shwi (const_tree t)
 {
diff --git a/gcc/var-tracking.cc b/gcc/var-tracking.cc
index 7c3ad0a55bd..2a3a0684e97 100644
--- a/gcc/var-tracking.cc
+++ b/gcc/var-tracking.cc
@@ -404,7 +404,7 @@  int_mem_offset (const_rtx mem)
   return 0;
 }
 
-#if CHECKING_P && (GCC_VERSION >= 2007)
+#if CHECKING_P
 
 /* Access VAR's Ith part's offset, checking that it's not a one-part
    variable.  */
diff --git a/gcc/vec.h b/gcc/vec.h
index 3ba7ea7edc2..3cb2772301c 100644
--- a/gcc/vec.h
+++ b/gcc/vec.h
@@ -295,10 +295,8 @@  va_heap::reserve (vec<T, va_heap, vl_embed> *&v, unsigned reserve, bool exact
 }
 
 
-#if GCC_VERSION >= 4007
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wfree-nonheap-object"
-#endif
 
 /* Free the heap space allocated for vector V.  */
 
@@ -317,9 +315,7 @@  va_heap::release (vec<T, va_heap, vl_embed> *&v)
   v = NULL;
 }
 
-#if GCC_VERSION >= 4007
 #pragma GCC diagnostic pop
-#endif
 
 /* Allocator type for GC vectors.  Notice that we need the structure
    declaration even if GC is not enabled.  */
@@ -2349,8 +2345,6 @@  make_array_slice (T *base, unsigned int size)
   return array_slice<T> (base, size);
 }
 
-#if (GCC_VERSION >= 3000)
-# pragma GCC poison m_vec m_vecpfx m_vecdata
-#endif
+#pragma GCC poison m_vec m_vecpfx m_vecdata
 
 #endif // GCC_VEC_H
diff --git a/gcc/wide-int.cc b/gcc/wide-int.cc
index f61b9fefc13..ffd96e6b9d9 100644
--- a/gcc/wide-int.cc
+++ b/gcc/wide-int.cc
@@ -37,7 +37,7 @@  along with GCC; see the file COPYING3.  If not see
 
 #define W_TYPE_SIZE HOST_BITS_PER_WIDE_INT
 /* Do not include longlong.h when compiler is clang-based. See PR61146.  */
-#if GCC_VERSION >= 3000 && (W_TYPE_SIZE == 32 || defined (__SIZEOF_INT128__)) && !defined(__clang__)
+#if (W_TYPE_SIZE == 32 || defined (__SIZEOF_INT128__)) && !defined(__clang__)
 typedef unsigned HOST_HALF_WIDE_INT UHWtype;
 typedef unsigned HOST_WIDE_INT UWtype;
 typedef unsigned int UQItype __attribute__ ((mode (QI)));