Removing GCC 2 support from cdefs.h

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Removing GCC 2 support from cdefs.h

Michael McConville-2
Index: sys/cdefs.h
===================================================================
RCS file: /cvs/src/sys/sys/cdefs.h,v
retrieving revision 1.39
diff -u -p -r1.39 cdefs.h
--- sys/cdefs.h 18 Apr 2014 11:51:17 -0000 1.39
+++ sys/cdefs.h 1 Oct 2015 23:31:42 -0000
@@ -88,30 +88,17 @@
 #endif /* !(__STDC__ || __cplusplus) */
 
 /*
- * GCC1 and some versions of GCC2 declare dead (non-returning) and
- * pure (no side effects) functions using "volatile" and "const";
- * unfortunately, these then cause warnings under "-ansi -pedantic".
- * GCC >= 2.5 uses the __attribute__((attrs)) style.  All of these
- * work for GNU C++ (modulo a slight glitch in the C++ grammar in
- * the distribution version of 2.5.5).
+ * GCC >= 2.5 and GNU C++ use the __attribute__((attrs)) style to
+ * declare dead (non-returning) and pure (no side effects)
+ * functions.
  */
 
-#if !__GNUC_PREREQ__(2, 5) && !defined(__PCC__)
-#define __attribute__(x) /* delete __attribute__ if non-gcc or gcc1 */
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-#define __dead __volatile
-#define __pure __const
-#endif
-#elif !defined(__STRICT_ANSI__)
+#if !defined(__STRICT_ANSI__)
 #define __dead __attribute__((__noreturn__))
 #define __pure __attribute__((__const__))
 #endif
 
-#if __GNUC_PREREQ__(2, 7)
 #define __unused __attribute__((__unused__))
-#else
-#define __unused /* delete */
-#endif
 
 #if __GNUC_PREREQ__(3, 1)
 #define __used __attribute__((__used__))
@@ -161,10 +148,10 @@
 #endif
 
 /*
- * GNU C version 2.96 adds explicit branch prediction so that
- * the CPU back-end can hint the processor and also so that
- * code blocks can be reordered such that the predicted path
- * sees a more linear flow, thus improving cache behavior, etc.
+ * GNU offers explicit branch prediction so that the CPU back-end
+ * can hint the processor and also so that code blocks can be
+ * reordered such that the predicted path sees a more linear flow,
+ * thus improving cache behavior, etc.
  *
  * The following two macros provide us with a way to utilize this
  * compiler feature.  Use __predict_true() if you expect the expression
@@ -188,13 +175,8 @@
  *  basic block reordering that this affects can often generate
  *  larger code.
  */
-#if __GNUC_PREREQ__(2, 96)
 #define __predict_true(exp) __builtin_expect(((exp) != 0), 1)
 #define __predict_false(exp) __builtin_expect(((exp) != 0), 0)
-#else
-#define __predict_true(exp) ((exp) != 0)
-#define __predict_false(exp) ((exp) != 0)
-#endif
 
 /* Delete pseudo-keywords wherever they are not available or needed. */
 #ifndef __dead
@@ -214,26 +196,12 @@
  * alignment of messages exchanged with hardware or other systems.
  */
 
-#if __GNUC_PREREQ__(2, 7) || defined(__PCC__)
 #define __packed __attribute__((__packed__))
 #define __aligned(x) __attribute__((__aligned__(x)))
-#endif
 
-#if !__GNUC_PREREQ__(2, 8)
-#define __extension__
-#endif
-
-#if __GNUC_PREREQ__(2, 8) || defined(__PCC__)
 #define __statement(x) __extension__(x)
-#else
-#define __statement(x) (x)
-#endif
 
-#if __GNUC_PREREQ__(3, 0)
 #define __malloc __attribute__((__malloc__))
-#else
-#define __malloc
-#endif
 
 #if defined(__cplusplus)
 #define __BEGIN_EXTERN_C extern "C" {

Reply | Threaded
Open this post in threaded view
|

Re: Removing GCC 2 support from cdefs.h

Jonathan Gray-11
This isn't just removing support for gcc 2 it is removing support for
anything that doesn't define __GNUC__ and implement all the gnu
attributes which isn't what we want.

On Thu, Oct 01, 2015 at 07:34:48PM -0400, Michael McConville wrote:

> Index: sys/cdefs.h
> ===================================================================
> RCS file: /cvs/src/sys/sys/cdefs.h,v
> retrieving revision 1.39
> diff -u -p -r1.39 cdefs.h
> --- sys/cdefs.h 18 Apr 2014 11:51:17 -0000 1.39
> +++ sys/cdefs.h 1 Oct 2015 23:31:42 -0000
> @@ -88,30 +88,17 @@
>  #endif /* !(__STDC__ || __cplusplus) */
>  
>  /*
> - * GCC1 and some versions of GCC2 declare dead (non-returning) and
> - * pure (no side effects) functions using "volatile" and "const";
> - * unfortunately, these then cause warnings under "-ansi -pedantic".
> - * GCC >= 2.5 uses the __attribute__((attrs)) style.  All of these
> - * work for GNU C++ (modulo a slight glitch in the C++ grammar in
> - * the distribution version of 2.5.5).
> + * GCC >= 2.5 and GNU C++ use the __attribute__((attrs)) style to
> + * declare dead (non-returning) and pure (no side effects)
> + * functions.
>   */
>  
> -#if !__GNUC_PREREQ__(2, 5) && !defined(__PCC__)
> -#define __attribute__(x) /* delete __attribute__ if non-gcc or gcc1 */
> -#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
> -#define __dead __volatile
> -#define __pure __const
> -#endif
> -#elif !defined(__STRICT_ANSI__)
> +#if !defined(__STRICT_ANSI__)
>  #define __dead __attribute__((__noreturn__))
>  #define __pure __attribute__((__const__))
>  #endif
>  
> -#if __GNUC_PREREQ__(2, 7)
>  #define __unused __attribute__((__unused__))
> -#else
> -#define __unused /* delete */
> -#endif
>  
>  #if __GNUC_PREREQ__(3, 1)
>  #define __used __attribute__((__used__))
> @@ -161,10 +148,10 @@
>  #endif
>  
>  /*
> - * GNU C version 2.96 adds explicit branch prediction so that
> - * the CPU back-end can hint the processor and also so that
> - * code blocks can be reordered such that the predicted path
> - * sees a more linear flow, thus improving cache behavior, etc.
> + * GNU offers explicit branch prediction so that the CPU back-end
> + * can hint the processor and also so that code blocks can be
> + * reordered such that the predicted path sees a more linear flow,
> + * thus improving cache behavior, etc.
>   *
>   * The following two macros provide us with a way to utilize this
>   * compiler feature.  Use __predict_true() if you expect the expression
> @@ -188,13 +175,8 @@
>   *  basic block reordering that this affects can often generate
>   *  larger code.
>   */
> -#if __GNUC_PREREQ__(2, 96)
>  #define __predict_true(exp) __builtin_expect(((exp) != 0), 1)
>  #define __predict_false(exp) __builtin_expect(((exp) != 0), 0)
> -#else
> -#define __predict_true(exp) ((exp) != 0)
> -#define __predict_false(exp) ((exp) != 0)
> -#endif
>  
>  /* Delete pseudo-keywords wherever they are not available or needed. */
>  #ifndef __dead
> @@ -214,26 +196,12 @@
>   * alignment of messages exchanged with hardware or other systems.
>   */
>  
> -#if __GNUC_PREREQ__(2, 7) || defined(__PCC__)
>  #define __packed __attribute__((__packed__))
>  #define __aligned(x) __attribute__((__aligned__(x)))
> -#endif
>  
> -#if !__GNUC_PREREQ__(2, 8)
> -#define __extension__
> -#endif
> -
> -#if __GNUC_PREREQ__(2, 8) || defined(__PCC__)
>  #define __statement(x) __extension__(x)
> -#else
> -#define __statement(x) (x)
> -#endif
>  
> -#if __GNUC_PREREQ__(3, 0)
>  #define __malloc __attribute__((__malloc__))
> -#else
> -#define __malloc
> -#endif
>  
>  #if defined(__cplusplus)
>  #define __BEGIN_EXTERN_C extern "C" {
>

Reply | Threaded
Open this post in threaded view
|

Re: Removing GCC 2 support from cdefs.h

Philip Guenther-2
On Thu, Oct 1, 2015 at 10:52 PM, Jonathan Gray <[hidden email]> wrote:
> This isn't just removing support for gcc 2 it is removing support for
> anything that doesn't define __GNUC__ and implement all the gnu
> attributes which isn't what we want.

Yep.  We've now seen a couple diffs labeled "remove gcc2 support"
which were unable to contain themselves to that.  If you want to
suggest something contentious, then say so instead of rolling it into
something everyone can agree on...and then don't be surprised when
it's contentious.  If you want to do something sure and simple, then
DO SOMETHING SIMPLE.

Philip

Reply | Threaded
Open this post in threaded view
|

Re: Removing GCC 2 support from cdefs.h

Michael McConville-2
Philip Guenther wrote:

> On Thu, Oct 1, 2015 at 10:52 PM, Jonathan Gray <[hidden email]> wrote:
> > This isn't just removing support for gcc 2 it is removing support
> > for anything that doesn't define __GNUC__ and implement all the gnu
> > attributes which isn't what we want.
>
> Yep.  We've now seen a couple diffs labeled "remove gcc2 support"
> which were unable to contain themselves to that.  If you want to
> suggest something contentious, then say so instead of rolling it into
> something everyone can agree on...and then don't be surprised when
> it's contentious.  If you want to do something sure and simple, then
> DO SOMETHING SIMPLE.

I wasn't trying to suggest something contentious, I just (incorrectly)
thought that there were different cdefs.h copies for the kernel and
userland. Mistake acknowledged.

Reply | Threaded
Open this post in threaded view
|

Re: Removing GCC 2 support from cdefs.h

Philip Guenther-2
On Sat, Oct 3, 2015 at 2:33 PM, Michael McConville
<[hidden email]> wrote:

> Philip Guenther wrote:
>> On Thu, Oct 1, 2015 at 10:52 PM, Jonathan Gray <[hidden email]> wrote:
>> > This isn't just removing support for gcc 2 it is removing support
>> > for anything that doesn't define __GNUC__ and implement all the gnu
>> > attributes which isn't what we want.
>>
>> Yep.  We've now seen a couple diffs labeled "remove gcc2 support"
>> which were unable to contain themselves to that.  If you want to
>> suggest something contentious, then say so instead of rolling it into
>> something everyone can agree on...and then don't be surprised when
>> it's contentious.  If you want to do something sure and simple, then
>> DO SOMETHING SIMPLE.
>
> I wasn't trying to suggest something contentious, I just (incorrectly)
> thought that there were different cdefs.h copies for the kernel and
> userland. Mistake acknowledged.

Sure, but seeing as someone else made a parallel flub reminding the
list of a pothole in getting their diffs committed seemed wise.

Philip