Skip to content

Commit

Permalink
Merge pull request equinor#130 from markusdregi/werror_final
Browse files Browse the repository at this point in the history
Fix compiler macros
  • Loading branch information
markusdregi authored Jun 27, 2017
2 parents 565b69d + f41d9b8 commit f55691b
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 20 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -214,14 +214,15 @@ check_function_exists( setenv HAVE_POSIX_SETENV )
check_function_exists( symlink ERT_HAVE_SYMLINK )
check_function_exists( timegm HAVE_TIMEGM )
check_function_exists( usleep HAVE__USLEEP )
check_function_exists( unlink HAVE_POSIX_UNLINK )
check_function_exists( _unlink HAVE_WINDOWS_UNLINK )

check_symbol_exists(_tzname time.h HAVE_WINDOWS_TZNAME)
check_symbol_exists( tzname time.h HAVE_TZNAME)

check_include_file(execinfo.h HAVE_EXECINFO)
check_include_file(getopt.h ERT_HAVE_GETOPT)
check_include_file(unistd.h ERT_HAVE_UNISTD)
check_include_file(io.h ERT_HAVE_IO)

check_type_size(time_t SIZE_OF_TIME_T)
if (${SIZE_OF_TIME_T} EQUAL 8)
Expand Down
2 changes: 2 additions & 0 deletions lib/build_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#cmakedefine HAVE_CHMOD
#cmakedefine HAVE_MODE_T
#cmakedefine HAVE_CXX_SHARED_PTR
#cmakedefine HAVE_POSIX_UNLINK
#cmakedefine HAVE_WINDOWS_UNLINK


#cmakedefine HAVE_WINDOWS_GET_TEMP_PATH
Expand Down
8 changes: 7 additions & 1 deletion lib/include/ert/util/util_unlink.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,17 @@
#ifndef ERT_UTIL_UNLINK_H
#define ERT_UTIL_UNLINK_H

#include "ert/util/build_config.h"

#ifdef __cplusplus
extern "C" {
#endif


#if defined(HAVE_POSIX_UNLINK) || defined(HAVE_WINDOWS_UNLINK)

int util_unlink(const char * filename);

#endif

#ifdef __cplusplus
}
Expand Down
4 changes: 0 additions & 4 deletions lib/util/hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,6 @@ typedef struct hash_sort_node {
/* locking */
/*****************************************************************/
#ifdef HAVE_PTHREAD
static void __hash_deadlock_abort(hash_type * hash) {
util_abort("%s: A deadlock condition has been detected in the hash routine - and the program will abort.\n", __func__);
}


static void __hash_rdlock(hash_type * hash) {
int lock_error = pthread_rwlock_tryrdlock( &hash->rwlock );
Expand Down
28 changes: 14 additions & 14 deletions lib/util/util_unlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@
for more details.
*/

#include "ert/util/build_config.h"

#if defined(ERT_HAVE_UNISTD)
#include <unistd.h>
#elif defined(ERT_HAVE_IO)
#include <io.h>
#else
#include <ert/util/util.h>
#endif
#if defined(HAVE_WINDOWS_UNLINK)

#include <io.h>

int util_unlink(const char * filename) {
#if defined(ERT_HAVE_UNISTD)
return unlink(filename);
#elif defined(ERT_HAVE_IO)
return _unlink(filename);
#else
util_abort("%s: No unlink functionality available.\n", __func__);
return -1;
#endif
}

#elif defined(HAVE_POSIX_UNLINK)

#include <unistd.h>

int util_unlink(const char * filename) {
return unlink(filename);
}

#endif

0 comments on commit f55691b

Please sign in to comment.