10000 compile correctly with -std=c99 by glennklockwood · Pull Request #101 · hpc/ior · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

compile correctly with -std=c99 #101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file 10000
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@ AM_INIT_AUTOMAKE([check-news dist-bzip2 gnu no-define foreign subdir-objects])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AM_MAINTAINER_MODE

# Check for system-specific stuff
case "${host_os}" in
*linux*)
;;
*darwin*)
CPPFLAGS="${CPPFLAGS} -D_DARWIN_C_SOURCE"
;;
*)
;;
esac

# Checks for programs

# We can't do anything without a working MPI
Expand Down
2 changes: 2 additions & 0 deletions src/aiori-DUMMY.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
# include "config.h"
#endif

#define _XOPEN_SOURCE 700

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
Expand Down
2 changes: 2 additions & 0 deletions src/aiori-MMAP.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
# include "config.h"
#endif

#define _XOPEN_SOURCE 700

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

Expand Down
11 changes: 11 additions & 0 deletions src/aiori.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,19 @@
*
\******************************************************************************/

#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#define _XOPEN_SOURCE 700

#include <assert.h>
#include <stdbool.h>

#if defined(HAVE_STRINGS_H)
#include <strings.h>
#endif

#include "aiori.h"

#if defined(HAVE_SYS_STATVFS_H)
Expand Down
29 changes: 20 additions & 9 deletions src/ior.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# include "config.h"
#endif

#define _XOPEN_SOURCE 700

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
Expand All @@ -20,6 +22,11 @@
#include <math.h>
#include <mpi.h>
#include <string.h>

#if defined(HAVE_STRINGS_H)
#include <strings.h>
#endif

#include <sys/stat.h> /* struct stat */
#include <time.h>

Expand Down Expand Up @@ -458,12 +465,16 @@ static int CountErrors(IOR_param_t * test, int access, int errors)
*/
static void *aligned_buffer_alloc(size_t size)
{
size_t pageSize;
size_t pageMask;
char *buf, *tmp;
char *aligned;

pageSize = getpagesize();
#ifdef HAVE_GETPAGESIZE
size_t pageSize = getpagesize();
#else
long pageSize = sysconf(_SC_PAGESIZE);
#endif

pageMask = pageSize - 1;
buf = malloc(size + pageSize + sizeof(void *));
if (buf == NULL)
Expand Down Expand Up @@ -1410,7 +1421,7 @@ static void TestIoSys(IOR_test_t *test)
/* random process offset reading */
if (params->reorderTasksRandom) {
/* this should not intefere with randomOffset within a file because GetOffsetArrayRandom */
/* seeds every random() call */
/* seeds every rand() call */
int nodeoffset;
unsigned int iseed0;
nodeoffset = params->taskPerNodeOffset;
Expand Down Expand Up @@ -1762,11 +1773,11 @@ static IOR_offset_t *GetOffsetArrayRandom(IOR_param_t * test, int pretendRank,

/* set up seed for random() */
if (access == WRITE || access == READ) {
test->randomSeed = seed = random();
test->randomSeed = seed = rand();
} else {
seed = test->randomSeed;
}
srandom(seed);
srand(seed);

fileSize = test->blockSize * test->segmentCount;
if (test->filePerProc == FALSE) {
Expand All @@ -1778,7 +1789,7 @@ static IOR_offset_t *GetOffsetArrayRandom(IOR_param_t * test, int pretendRank,
if (test->filePerProc == FALSE) {
// this counts which process get how many transferes in
// a shared file
if ((random() % test->numTasks) == pretendRank) {
if ((rand() % test->numTasks) == pretendRank) {
offsets++;
}
} else {
Expand All @@ -1800,17 +1811,17 @@ static IOR_offset_t *GetOffsetArrayRandom(IOR_param_t * test, int pretendRank,
}
} else {
/* fill with offsets (pass 2) */
srandom(seed); /* need same seed to get same transfers as counted in the beginning*/
srand(seed); /* need same seed to get same transfers as counted in the beginning*/
for (i = 0; i < fileSize; i += test->transferSize) {
if ((random() % test->numTasks) == pretendRank) {
if ((rand() % test->numTasks) == pretendRank) {
offsetArray[offsetCnt] = i;
offsetCnt++;
}
}
}
/* reorder array */
for (i = 0; i < offsets; i++) {
value = random() % offsets;
value = rand() % offsets;
tmp = offsetArray[value];
offsetArray[value] = offsetArray[i];
offsetArray[i] = tmp;
Expand Down
8 changes: 7 additions & 1 deletion src/mdtest.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
* $Date: 2013/11/27 17:05:31 $
* $Author: brettkettering $
*/
#define _XOPEN_SOURCE 700

#include <limits.h>
#include <math.h>
Expand Down Expand Up @@ -59,6 +60,11 @@

#include <fcntl.h>
#include <string.h>

#if HAVE_STRINGS_H
#include <strings.h>
#endif

#include <unistd.h>
#include <dirent.h>
#include <errno.h>
Expand Down Expand Up @@ -1616,7 +1622,7 @@ void valid_tests() {
FAIL("-c not compatible with -B");
}

if ( strcasecmp(backend_name, "POSIX") != 0 && strcasecmp(backend_name, "DUMMY") != 0) {
if (strcasecmp(backend_name, "POSIX") != 0 && strcasecmp(backend_name, "DUMMY") != 0) {
FAIL("-a only supported interface is POSIX (and DUMMY) right now!");
}

Expand Down
1 change: 1 addition & 0 deletions src/option.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#define _XOPEN_SOURCE 700
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
Expand Down
5 changes: 5 additions & 0 deletions src/parse_options.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,16 @@
#include "config.h"
#endif

#define _XOPEN_SOURCE 700

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>

#if defined(HAVE_STRINGS_H)
#include <strings.h>
#endif

#include "utilities.h"
#include "ior.h"
Expand Down
2 changes: 1 addition & 1 deletion travis-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#

# These options will be passed directly to the autoconf configure script
CONFIGURE_OPTS="${CONFIGURE_OPTS:-""}"
CONFIGURE_OPTS="${CONFIGURE_OPTS:-"CFLAGS=-std=c99 --disable-silent-rules"}"

BASE_DIR="$(cd "${0%/*}" && pwd)"
if [ -z "$BASE_DIR" -o ! -d "$BASE_DIR" ]; then
Expand Down
0