From aeee4812442c996f184965ce6894e5f3d3657c0f Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Mon, 2 Jan 2023 09:37:43 +0100 Subject: Update copyright years. --- gcc/bitmap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/bitmap.h') diff --git a/gcc/bitmap.h b/gcc/bitmap.h index 7fba443..a439f93 100644 --- a/gcc/bitmap.h +++ b/gcc/bitmap.h @@ -1,5 +1,5 @@ /* Functions to support general ended bitmaps. - Copyright (C) 1997-2022 Free Software Foundation, Inc. + Copyright (C) 1997-2023 Free Software Foundation, Inc. This file is part of GCC. -- cgit v1.1 From cb3e0eac262e55774949b1717c64da383adbc621 Mon Sep 17 00:00:00 2001 From: Patrick Palka Date: Thu, 16 Feb 2023 10:30:20 -0500 Subject: don't declare header-defined functions both static and inline Many functions defined in our headers are declared 'static inline' which is a C idiom whose use predates our move to C++ as the implementation language. But in C++ the inline keyword is more than just a compiler hint, and is sufficient to give the function the intended semantics. In fact declaring a function both static and inline is a pessimization since static effectively disables the desired definition merging behavior enabled by inline, and is also a source of (harmless) ODR violations when a static inline function gets called from a non-static inline one (such as tree_operand_check calling tree_operand_length). This patch mechanically fixes the vast majority of occurrences of this anti-pattern throughout the compiler's headers via the command line sed -i 's/^static inline/inline/g' gcc/*.h gcc/*/*.h There's also a manual change to remove the redundant declarations of is_ivar and lookup_category in gcc/objc/objc-act.cc which would otherwise conflict with their modified definitions in objc-act.h (due to the difference in staticness). Besides fixing some ODR violations, this speeds up stage1 cc1plus by about 2% and reduces the size of its text segment by 1.5MB. gcc/ChangeLog: * addresses.h: Mechanically drop 'static' from 'static inline' functions via s/^static inline/inline/g. * asan.h: Likewise. * attribs.h: Likewise. * basic-block.h: Likewise. * bitmap.h: Likewise. * cfghooks.h: Likewise. * cfgloop.h: Likewise. * cgraph.h: Likewise. * cselib.h: Likewise. * data-streamer.h: Likewise. * debug.h: Likewise. * df.h: Likewise. * diagnostic.h: Likewise. * dominance.h: Likewise. * dumpfile.h: Likewise. * emit-rtl.h: Likewise. * except.h: Likewise. * expmed.h: Likewise. * expr.h: Likewise. * fixed-value.h: Likewise. * gengtype.h: Likewise. * gimple-expr.h: Likewise. * gimple-iterator.h: Likewise. * gimple-predict.h: Likewise. * gimple-range-fold.h: Likewise. * gimple-ssa.h: Likewise. * gimple.h: Likewise. * graphite.h: Likewise. * hard-reg-set.h: Likewise. * hash-map.h: Likewise. * hash-set.h: Likewise. * hash-table.h: Likewise. * hwint.h: Likewise. * input.h: Likewise. * insn-addr.h: Likewise. * internal-fn.h: Likewise. * ipa-fnsummary.h: Likewise. * ipa-icf-gimple.h: Likewise. * ipa-inline.h: Likewise. * ipa-modref.h: Likewise. * ipa-prop.h: Likewise. * ira-int.h: Likewise. * ira.h: Likewise. * lra-int.h: Likewise. * lra.h: Likewise. * lto-streamer.h: Likewise. * memmodel.h: Likewise. * omp-general.h: Likewise. * optabs-query.h: Likewise. * optabs.h: Likewise. * plugin.h: Likewise. * pretty-print.h: Likewise. * range.h: Likewise. * read-md.h: Likewise. * recog.h: Likewise. * regs.h: Likewise. * rtl-iter.h: Likewise. * rtl.h: Likewise. * sbitmap.h: Likewise. * sched-int.h: Likewise. * sel-sched-ir.h: Likewise. * sese.h: Likewise. * sparseset.h: Likewise. * ssa-iterators.h: Likewise. * system.h: Likewise. * target-globals.h: Likewise. * target.h: Likewise. * timevar.h: Likewise. * tree-chrec.h: Likewise. * tree-data-ref.h: Likewise. * tree-iterator.h: Likewise. * tree-outof-ssa.h: Likewise. * tree-phinodes.h: Likewise. * tree-scalar-evolution.h: Likewise. * tree-sra.h: Likewise. * tree-ssa-alias.h: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-manip.h: Likewise. * tree-ssa-loop.h: Likewise. * tree-ssa-operands.h: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa.h: Likewise. * tree-ssanames.h: Likewise. * tree-streamer.h: Likewise. * tree-switch-conversion.h: Likewise. * tree-vectorizer.h: Likewise. * tree.h: Likewise. * wide-int.h: Likewise. gcc/c-family/ChangeLog: * c-common.h: Mechanically drop static from static inline functions via s/^static inline/inline/g. gcc/c/ChangeLog: * c-parser.h: Mechanically drop static from static inline functions via s/^static inline/inline/g. gcc/cp/ChangeLog: * cp-tree.h: Mechanically drop static from static inline functions via s/^static inline/inline/g. gcc/fortran/ChangeLog: * gfortran.h: Mechanically drop static from static inline functions via s/^static inline/inline/g. gcc/jit/ChangeLog: * jit-dejagnu.h: Mechanically drop static from static inline functions via s/^static inline/inline/g. * jit-recording.h: Likewise. gcc/objc/ChangeLog: * objc-act.h: Mechanically drop static from static inline functions via s/^static inline/inline/g. * objc-map.h: Likewise. * objc-act.cc: Remove the redundant redeclarations of is_ivar and lookup_category. --- gcc/bitmap.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'gcc/bitmap.h') diff --git a/gcc/bitmap.h b/gcc/bitmap.h index a439f93..43337d2 100644 --- a/gcc/bitmap.h +++ b/gcc/bitmap.h @@ -461,7 +461,7 @@ extern void dump_bitmap_statistics (void); /* Initialize a bitmap header. OBSTACK indicates the bitmap obstack to allocate from, NULL for GC'd bitmap. */ -static inline void +inline void bitmap_initialize (bitmap head, bitmap_obstack *obstack CXX_MEM_STAT_INFO) { head->first = head->current = NULL; @@ -476,7 +476,7 @@ bitmap_initialize (bitmap head, bitmap_obstack *obstack CXX_MEM_STAT_INFO) /* Release a bitmap (but not its head). This is suitable for pairing with bitmap_initialize. */ -static inline void +inline void bitmap_release (bitmap head) { bitmap_clear (head); @@ -532,7 +532,7 @@ struct bitmap_iterator /* Initialize a single bitmap iterator. START_BIT is the first bit to iterate from. */ -static inline void +inline void bmp_iter_set_init (bitmap_iterator *bi, const_bitmap map, unsigned start_bit, unsigned *bit_no) { @@ -576,7 +576,7 @@ bmp_iter_set_init (bitmap_iterator *bi, const_bitmap map, /* Initialize an iterator to iterate over the intersection of two bitmaps. START_BIT is the bit to commence from. */ -static inline void +inline void bmp_iter_and_init (bitmap_iterator *bi, const_bitmap map1, const_bitmap map2, unsigned start_bit, unsigned *bit_no) { @@ -645,7 +645,7 @@ bmp_iter_and_init (bitmap_iterator *bi, const_bitmap map1, const_bitmap map2, /* Initialize an iterator to iterate over the bits in MAP1 & ~MAP2. */ -static inline void +inline void bmp_iter_and_compl_init (bitmap_iterator *bi, const_bitmap map1, const_bitmap map2, unsigned start_bit, unsigned *bit_no) @@ -696,7 +696,7 @@ bmp_iter_and_compl_init (bitmap_iterator *bi, /* Advance to the next bit in BI. We don't advance to the next nonzero bit yet. */ -static inline void +inline void bmp_iter_next (bitmap_iterator *bi, unsigned *bit_no) { bi->bits >>= 1; @@ -705,7 +705,7 @@ bmp_iter_next (bitmap_iterator *bi, unsigned *bit_no) /* Advance to first set bit in BI. */ -static inline void +inline void bmp_iter_next_bit (bitmap_iterator * bi, unsigned *bit_no) { #if (GCC_VERSION >= 3004) @@ -728,7 +728,7 @@ bmp_iter_next_bit (bitmap_iterator * bi, unsigned *bit_no) already advanced past the just iterated bit. Return true if there is a bit to iterate. */ -static inline bool +inline bool bmp_iter_set (bitmap_iterator *bi, unsigned *bit_no) { /* If our current word is nonzero, it contains the bit we want. */ @@ -774,7 +774,7 @@ bmp_iter_set (bitmap_iterator *bi, unsigned *bit_no) bitmaps. We will have already advanced past the just iterated bit. Return true if there is a bit to iterate. */ -static inline bool +inline bool bmp_iter_and (bitmap_iterator *bi, unsigned *bit_no) { /* If our current word is nonzero, it contains the bit we want. */ @@ -843,7 +843,7 @@ bmp_iter_and (bitmap_iterator *bi, unsigned *bit_no) complemented bitmaps. We will have already advanced past the just iterated bit. */ -static inline bool +inline bool bmp_iter_and_compl (bitmap_iterator *bi, unsigned *bit_no) { /* If our current word is nonzero, it contains the bit we want. */ -- cgit v1.1