Hi Jakub,

> The OpenMP 5.0 specification, https://www.openmp.org/specifications/ ,
> has been just released a few minutes ago and to celebrate that, I've merged
> gomp-5_0-branch into trunk after bootstrapping/regtesting it on x86_64-linux 
> and
> i686-linux.

this patch series broke the Solaris build:

/vol/gcc/src/hg/trunk/local/libgomp/affinity.c: In function 
'gomp_display_affinity_place':
/vol/gcc/src/hg/trunk/local/libgomp/affinity.c:145:3: error: unknown type name 
'cpu_set_t'
  145 |   cpu_set_t *cpusetp;
      |   ^~~~~~~~~
/vol/gcc/src/hg/trunk/local/libgomp/affinity.c:148:5: error: implicit 
declaration of function 'sprintf' [-Werror=implicit-function-declaration]
  148 |     sprintf (buf, "0-%lu", gomp_available_cpus - 1);
      |     ^~~~~~~

/vol/gcc/src/hg/trunk/local/libgomp/affinity.c:148:5: error: implicit 
declaration of function 'sprintf' [-Werror=implicit-function-declaration]
  148 |     sprintf (buf, "0-%lu", gomp_available_cpus - 1);
      |     ^~~~~~~
/vol/gcc/src/hg/trunk/local/libgomp/affinity.c:148:5: error: incompatible 
implicit declaration of built-in function 'sprintf' [-Werror]
/vol/gcc/src/hg/trunk/local/libgomp/affinity.c:29:1: note: include '<stdio.h>' 
or provide a declaration of 'sprintf'
   28 | #include "libgomp.h"
  +++ |+#include <stdio.h>
   29 |
/vol/gcc/src/hg/trunk/local/libgomp/affinity.c:150:5: error: implicit 
declaration of function 'strcpy' [-Werror=implicit-function-declaration]
  150 |     strcpy (buf, "0");
      |     ^~~~~~
/vol/gcc/src/hg/trunk/local/libgomp/affinity.c:150:5: error: incompatible 
implicit declaration of built-in function 'strcpy' [-Werror]
/vol/gcc/src/hg/trunk/local/libgomp/affinity.c:29:1: note: include '<string.h>' 
or provide a declaration of 'strcpy'
   28 | #include "libgomp.h"
  +++ |+#include <string.h>
   29 |
/vol/gcc/src/hg/trunk/local/libgomp/affinity.c:151:48: error: implicit 
declaration of function 'strlen' [-Werror=implicit-function-declaration]
  151 |   gomp_display_string (buffer, size, ret, buf, strlen (buf));
      |                                                ^~~~~~

/vol/gcc/src/hg/trunk/local/libgomp/teams.c: In function 'GOMP_teams_reg':
/vol/gcc/src/hg/trunk/local/libgomp/teams.c:44:19: error: 'INT_MAX' undeclared 
(first use in this function)
   44 |  = thread_limit > INT_MAX ? UINT_MAX : thread_limit;
      |                   ^~~~~~~
/vol/gcc/src/hg/trunk/local/libgomp/teams.c:29:1: note: 'INT_MAX' is defined in 
header '<limits.h>'; did you forget to '#include <limits.h>'?
   28 | #include "libgomp.h"
  +++ |+#include <limits.h>
   29 |
/vol/gcc/src/hg/trunk/local/libgomp/teams.c:44:19: note: each undeclared 
identifier is reported only once for each function it appears in
   44 |  = thread_limit > INT_MAX ? UINT_MAX : thread_limit;
      |                   ^~~~~~~
/vol/gcc/src/hg/trunk/local/libgomp/teams.c:44:29: error: 'UINT_MAX' undeclared 
(first use in this function)
   44 |  = thread_limit > INT_MAX ? UINT_MAX : thread_limit;
      |                             ^~~~~~~~

The patch below fixes this and allows the build to continue on
i386-pc-solaris2.1[01] and sparc-sun-solaris2.11.  Also built on
x86_64-pc-linux-gnu.

I guess this is obvious?

        Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


2018-11-08  Rainer Orth  <r...@cebitec.uni-bielefeld.de>

        * affinity.c: Include <string.h>, <stdio.h>.
        (gomp_display_affinity_place): Remove cpusetp.
        * teams.c: Include <limits.h>.

# HG changeset patch
# Parent  84ce7857bee0cad12f0066cd39dcdf95644c1a6d
Fix Solaris build with OpenMP 5.0

diff --git a/libgomp/affinity.c b/libgomp/affinity.c
--- a/libgomp/affinity.c
+++ b/libgomp/affinity.c
@@ -26,6 +26,8 @@
 /* This is a generic stub implementation of a CPU affinity setting.  */
 
 #include "libgomp.h"
+#include <string.h>
+#include <stdio.h>
 
 void
 gomp_init_affinity (void)
@@ -142,7 +144,6 @@ void
 gomp_display_affinity_place (char *buffer, size_t size, size_t *ret,
 			     int place)
 {
-  cpu_set_t *cpusetp;
   char buf[sizeof (long) * 3 + 4];
   if (gomp_available_cpus > 1)
     sprintf (buf, "0-%lu", gomp_available_cpus - 1);
diff --git a/libgomp/teams.c b/libgomp/teams.c
--- a/libgomp/teams.c
+++ b/libgomp/teams.c
@@ -26,6 +26,7 @@
 /* This file handles the host TEAMS construct.  */
 
 #include "libgomp.h"
+#include <limits.h>
 
 static unsigned gomp_num_teams = 1, gomp_team_num = 0;
 

Reply via email to