Skip to content

Commit c4c6c75

Browse files
committed
Fix Solaris compilation
As detailed in Issue #57642, the `test-suite` doesn't compile on Solaris. This patch fixes the compilation issues as explained there. Tested on `amd64-pc-solaris2.11` (8 failures, all `fpcmp-target: Comparison failed`), `sparcv9-sun-solaris2.11` (11 failures, same `fpcmp-target` errors), and `x86_64-pc-linux-gnu` (no regressions). Differential Revision: https://reviews.llvm.org/D133579
1 parent d620853 commit c4c6c75

File tree

12 files changed

+23
-28
lines changed

12 files changed

+23
-28
lines changed

MicroBenchmarks/ImageProcessing/Dither/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ void BENCHMARK_ORDERED_DITHER(benchmark::State &state) {
6969
int height = state.range(0);
7070
int width = state.range(0);
7171
int m = state.range(1);
72-
int n = pow(m, 2);
72+
int n = pow((double)m, 2);
7373
int *outputImage = (int *)malloc(sizeof(int) * height * width);
7474
int *temp = (int *)malloc(sizeof(int) * height * width);
7575

MicroBenchmarks/libs/benchmark/test/benchmark_setup_teardown_test.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@
1010

1111
// Test that Setup() and Teardown() are called exactly once
1212
// for each benchmark run (single-threaded).
13-
namespace single {
13+
namespace singlethreaded {
1414
static int setup_call = 0;
1515
static int teardown_call = 0;
16-
} // namespace single
16+
} // namespace singlethreaded
1717
static void DoSetup1(const benchmark::State& state) {
18-
++single::setup_call;
18+
++singlethreaded::setup_call;
1919

2020
// Setup/Teardown should never be called with any thread_idx != 0.
2121
assert(state.thread_index() == 0);
2222
}
2323

2424
static void DoTeardown1(const benchmark::State& state) {
25-
++single::teardown_call;
25+
++singlethreaded::teardown_call;
2626
assert(state.thread_index() == 0);
2727
}
2828

@@ -134,8 +134,8 @@ int main(int argc, char** argv) {
134134
assert(ret > 0);
135135

136136
// Setup/Teardown is called once for each arg group (1,3,5,7).
137-
assert(single::setup_call == 4);
138-
assert(single::teardown_call == 4);
137+
assert(singlethreaded::setup_call == 4);
138+
assert(singlethreaded::teardown_call == 4);
139139

140140
// 3 group of threads calling this function (3,5,10).
141141
assert(concurrent::setup_call.load(std::memory_order_relaxed) == 3);

MultiSource/Applications/ClamAV/libclamav_readdb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1069,7 +1069,7 @@ static int dirent_compare(const struct dirent *a, const struct dirent *b) {
10691069
int ret = strcmp(a->d_name, b->d_name);
10701070
if (ret != 0)
10711071
return ret;
1072-
#ifdef _AIX
1072+
#if defined(_AIX) || (defined(__sun__) && defined(__svr4__))
10731073
struct stat a_stat;
10741074
struct stat b_stat;
10751075
stat(a->d_name, &a_stat);

MultiSource/Applications/oggenc/oggenc.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* Portions from Vorbize, (c) Kenneth Arnold <[email protected]>
99
* and libvorbis examples, (c) Monty <[email protected]>
1010
*/
11+
#include <alloca.h>
1112
#include <assert.h>
1213
#include <ctype.h>
1314
#include <errno.h>
@@ -23,8 +24,8 @@
2324
#include <sys/types.h>
2425
#include <time.h>
2526
#include <unistd.h>
26-
#ifdef __XS1B__
2727
#include <stdint.h>
28+
#ifdef __XS1B__
2829
#include "xcoretestsuite.h"
2930
#endif
3031

@@ -129,9 +130,9 @@ extern int _getopt_internal (int ___argc, char *const *___argv,
129130

130131
/* these are filled in by configure */
131132
typedef int16_t ogg_int16_t;
132-
typedef u_int16_t ogg_uint16_t;
133+
typedef uint16_t ogg_uint16_t;
133134
typedef int32_t ogg_int32_t;
134-
typedef u_int32_t ogg_uint32_t;
135+
typedef uint32_t ogg_uint32_t;
135136
typedef int64_t ogg_int64_t;
136137

137138
typedef struct {

MultiSource/Applications/viterbi/read_dmatrix.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include <stdio.h>
2+
#include <string.h>
23
#include <memory.h>
34

45
#include "common.h"

MultiSource/Benchmarks/DOE-ProxyApps-C++/CLAMR/fmemopen.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// limitations under the License.
1616
//
1717

18-
#if !defined(__linux__) && !defined(__NetBSD__)
18+
#if !defined(__linux__) && !defined(__NetBSD__) && !(defined(__sun__) && defined(__svr4__))
1919

2020
#include <stdio.h>
2121
#include <stdlib.h>

MultiSource/Benchmarks/McCat/05-eks/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@
3232
/* contains the eigenvalues for each of the matrixes. */
3333
/* */
3434
/************************************************************************/
35+
#include <stdio.h>
36+
#include <string.h>
3537
#include "main.h"
3638
#include "QRfact.h"
3739
#include "Triang.h"
3840
#include "Jacobi.h"
39-
#include <stdio.h>
40-
#include <string.h>
4141
Matrix A,Q,U;
4242

4343
int comp(const double *a,const double *b)

MultiSource/Benchmarks/MiBench/consumer-lame/rtp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <unistd.h>
55
#include <stdlib.h>
66
#include <stdio.h>
7+
#include <alloca.h>
78
#include <sys/types.h>
89
#include <sys/socket.h>
910
#include <arpa/inet.h>

MultiSource/Benchmarks/MiBench/office-ispell/term.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ static char Rcs_Id[] =
7272
#include "msgs.h"
7373
#include <signal.h>
7474

75-
#if defined(__GLIBC__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__APPLE__)
75+
#if defined(__GLIBC__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__APPLE__) || (defined(__sun__) && defined(__svr4__))
7676
/* Use termios under at least glibc */
7777
#include <termios.h>
7878
#define USE_TERMIOS

SingleSource/Regression/C/gcc-c-torture/execute/CMakeLists.txt

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,6 @@ file(GLOB TestRequiresLibM CONFIGURE_DEPENDS
193193
complex-5.c # -lm needed on FreeBSD
194194
)
195195

196-
# Tests that require newnlib Nano IO (--undefined=_printf_float ldflag)
197-
file(GLOB TestRequiresNanoIO CONFIGURE_DEPENDS
198-
920501-8.c
199-
930513-1.c
200-
)
201-
202196
##
203197
## Architecture-specific Test Blacklists
204198
##
@@ -369,10 +363,6 @@ foreach(File ${TestFiles})
369363
list(APPEND MaybeCFlags "-fwrapv")
370364
endif()
371365

372-
if(${File} IN_LIST TestRequiresNanoIO)
373-
list(APPEND MaybeLDFlags "-Wl,-u,_printf_float")
374-
endif()
375-
376366
# Add Test Target
377367
gcc_torture_execute_test(${File}
378368
PREFIX "GCC-C-execute"

litsupport/modules/hash.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ def compute(context):
1010
return
1111
executable = context.executable
1212
try:
13-
# Darwin's "strip" doesn't support these arguments.
14-
if platform.system() != 'Darwin':
13+
# Darwin's and Solaris' "strip" don't support these arguments.
14+
if platform.system() != 'Darwin' and platfor.system() != 'SunOS':
1515
stripped_executable = executable + '.stripped'
1616
testplan.check_call([context.config.strip_tool,
1717
'--remove-section=.comment',

tools/timeit.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ static int execute_target_process(char * const argv[]) {
333333
if (g_target_data_size_limit != ~(rlim_t) 0) {
334334
set_resource_limit(RLIMIT_DATA, g_target_data_size_limit);
335335
}
336-
#if !defined(__APPLE__)
336+
#if defined(RLIMIT_RSS) && !defined(__APPLE__)
337337
// On Apple platforms, RLIMIT_RSS is mapped to RLIMIT_AS and setting RLIMIT_AS
338338
// to a value smaller than the current virtual memory size will fail, This is
339339
// incompatible with the current usage in timeit and can cause issues on
@@ -352,9 +352,11 @@ static int execute_target_process(char * const argv[]) {
352352
if (g_target_file_count_limit != ~(rlim_t) 0) {
353353
set_resource_limit(RLIMIT_NOFILE, g_target_file_count_limit);
354354
}
355+
#ifdef RLIMIT_NPROC
355356
if (g_target_subprocess_count_limit != ~(rlim_t) 0) {
356357
set_resource_limit(RLIMIT_NPROC, g_target_subprocess_count_limit);
357358
}
359+
#endif
358360

359361
/* Honor the desired target execute directory. */
360362
if (g_target_exec_directory) {

0 commit comments

Comments
 (0)