This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
pp_(get|set)priority: remove ancient glibc C++ workaround
authorDagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Tue, 4 Feb 2020 15:24:54 +0000 (15:24 +0000)
committerDagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Tue, 4 Feb 2020 15:24:54 +0000 (15:24 +0000)
Glibc has enum typedefs for some arguments that are defined as `int`
by the X/Open standard.  This is fine in C, but until glibc
2.3 (released in 2002) this was also done for C++, which is not
allowed.

pp_sys.c

index 2515277..a4ff609 100644 (file)
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -4619,19 +4619,13 @@ PP(pp_setpgrp)
 #endif
 }
 
-#if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3) || (__GLIBC__ > 2))
-#  define PRIORITY_WHICH_T(which) (__priority_which_t)which
-#else
-#  define PRIORITY_WHICH_T(which) which
-#endif
-
 PP(pp_getpriority)
 {
 #ifdef HAS_GETPRIORITY
     dSP; dTARGET;
     const int who = POPi;
     const int which = TOPi;
-    SETi( getpriority(PRIORITY_WHICH_T(which), who) );
+    SETi( getpriority(which, who) );
     RETURN;
 #else
     DIE(aTHX_ PL_no_func, "getpriority");
@@ -4646,15 +4640,13 @@ PP(pp_setpriority)
     const int who = POPi;
     const int which = TOPi;
     TAINT_PROPER("setpriority");
-    SETi( setpriority(PRIORITY_WHICH_T(which), who, niceval) >= 0 );
+    SETi( setpriority(which, who, niceval) >= 0 );
     RETURN;
 #else
     DIE(aTHX_ PL_no_func, "setpriority");
 #endif
 }
 
-#undef PRIORITY_WHICH_T
-
 /* Time calls. */
 
 PP(pp_time)