Skip to content

Commit bd0ee62

Browse files
committed
Protect headers and use __WINDOWS__ for Windows code.
This commit was SVN r8468.
1 parent 8c71f57 commit bd0ee62

File tree

18 files changed

+46
-28
lines changed

18 files changed

+46
-28
lines changed

opal/class/opal_object.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,9 @@
115115
#define OPAL_OBJECT_H
116116

117117
#include <assert.h>
118+
#ifdef HAVE_STDLIB_H
118119
#include <stdlib.h>
120+
#endif /* HAVE_STDLIB_H */
119121

120122
#include "include/sys/atomic.h"
121123

opal/mca/base/mca_base_component_find.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ static void find_dyn_components(const char *path, const char *type_name,
215215
dir = path_to_use;
216216
if (NULL != dir) {
217217
do {
218-
#ifdef WIN32
218+
#ifdef __WINDOWS__
219219
end = strchr(dir, ';');
220220
#else
221221
end = strchr(dir, ':');

opal/mca/base/mca_base_open.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ int mca_base_open(void)
6969

7070
/* Register some params */
7171

72-
#ifdef WIN32
72+
#ifdef __WINDOWS__
7373
asprintf(&value, "%s;~/.openmpi/components", OMPI_PKGLIBDIR);
7474
#else
7575
asprintf(&value, "%s:~/.openmpi/components", OMPI_PKGLIBDIR);
@@ -121,7 +121,7 @@ static void set_defaults(opal_output_stream_t *lds)
121121
/* Load up defaults */
122122

123123
OBJ_CONSTRUCT(lds, opal_output_stream_t);
124-
#ifndef WIN32
124+
#ifndef __WINDOWS__
125125
lds->lds_syslog_priority = LOG_INFO;
126126
#endif
127127
lds->lds_syslog_ident = "ompi";
@@ -154,7 +154,7 @@ static void parse_verbose(char *e, opal_output_stream_t *lds)
154154
}
155155

156156
if (0 == strcasecmp(ptr, "syslog")) {
157-
#ifndef WIN32 /* there is no syslog */
157+
#ifndef __WINDOWS__ /* there is no syslog */
158158
lds->lds_want_syslog = true;
159159
have_output = true;
160160
}

opal/memoryhooks/memory.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@
1818

1919
#include "ompi_config.h"
2020

21+
#ifdef HAVE_SYS_TYPES_H
2122
#include <sys/types.h>
23+
#endif /* HAVE_SYS_TYPES_H */
24+
#ifdef HAVE_SYS_MMAN_H
2225
#include <sys/mman.h>
26+
#endif /* HAVE_SYS_MMAN_H */
2327

2428
#include "opal/include/constants.h"
2529
#include "opal/util/output.h"

opal/runtime/opal_progress.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ opal_progress(void)
295295
#endif
296296
}
297297

298-
#if !defined(WIN32) && defined(HAVE_SCHED_YIELD)
298+
#if !defined(__WINDOWS__) && defined(HAVE_SCHED_YIELD)
299299
if (call_yield && events <= 0) {
300300
/* If there is nothing to do - yield the processor - otherwise
301301
* we could consume the processor for the entire time slice. If

opal/threads/mutex.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
bool opal_uses_threads = (bool) OMPI_HAVE_THREAD_SUPPORT;
2727

2828

29-
#ifdef WIN32
29+
#ifdef __WINDOWS__
3030

3131
#include <windows.h>
3232

opal/threads/thread.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ static void opal_thread_construct(opal_thread_t *t)
4545
}
4646

4747

48-
#if defined(WIN32)
48+
#ifdef __WINDOWS__
4949

5050
/************************************************************************
5151
* Windows threads

opal/threads/threads.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#ifndef OPAL_THREAD_H
2020
#define OPAL_THREAD_H 1
2121

22-
#ifdef WIN32
22+
#ifdef __WINDOWS__
2323
#include <windows.h>
2424
#elif OMPI_HAVE_POSIX_THREADS
2525
#include <pthread.h>
@@ -39,7 +39,7 @@ struct opal_thread_t {
3939
opal_object_t super;
4040
opal_thread_fn_t t_run;
4141
void* t_arg;
42-
#ifdef WIN32
42+
#ifdef __WINDOWS__
4343
HANDLE t_handle;
4444
#elif OMPI_HAVE_POSIX_THREADS
4545
pthread_t t_handle;

opal/util/argv.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,12 @@
1717
*/
1818

1919
#include "ompi_config.h"
20+
#ifdef HAVE_STDLIB_H
2021
#include <stdlib.h>
22+
#endif /* HAVE_STDLIB_H */
23+
#ifdef HAVE_STRING_H
2124
#include <string.h>
25+
#endif /* HAVE_STRING_H */
2226

2327
#include "opal/util/argv.h"
2428
#include "opal/util/strncpy.h"

opal/util/basename.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ char *opal_basename(const char *filename)
2929
{
3030
size_t i;
3131
char *tmp, *ret = NULL;
32-
#ifdef WIN32
32+
#ifdef __WINDOWS__
3333
const char sep = '\\';
3434
#else
3535
const char sep = '/';
@@ -43,7 +43,7 @@ char *opal_basename(const char *filename)
4343

4444
/* On Windows, automatically exclude a drive designator */
4545

46-
#ifdef WIN32
46+
#ifdef __WINDOWS__
4747
if (strlen(filename) == 2 &&
4848
isalpha(filename[0]) && ':' == filename[1]) {
4949
return strdup(filename);

0 commit comments

Comments
 (0)