Skip to content

Commit

Permalink
Merge branch 'master' into cleanup-include-cpp-file
Browse files Browse the repository at this point in the history
  • Loading branch information
mgeplf committed Apr 27, 2024
2 parents e2b369f + 8b35309 commit a42c21e
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 34 deletions.
5 changes: 0 additions & 5 deletions cmake/ConfigFileSetting.cmake
Expand Up @@ -144,11 +144,6 @@ nrn_check_type_exists(sys/types.h pid_t int pid_t)
nrn_check_type_exists(sys/types.h size_t "unsigned int" size_t)
nrn_check_type_exists(sys/types.h uid_t int uid_t)

# =============================================================================
# Set return type of signal in RETSIGTYPE
# =============================================================================
nrn_check_signal_return_type(RETSIGTYPE)

# =============================================================================
# Generate file from file.in template
# =============================================================================
Expand Down
17 changes: 0 additions & 17 deletions cmake/MacroHelper.cmake
Expand Up @@ -62,23 +62,6 @@ macro(nrn_check_type_exists HEADER TYPE DEFAULT_TYPE VARIABLE)
file(REMOVE "conftest.cpp")
endmacro()

# =============================================================================
# Check return type of signal
# =============================================================================
macro(nrn_check_signal_return_type VARIABLE)
# code template to check signal support
string(CONCAT CONFTEST_RETSIGTYPE "#include <sys/types.h>\n" "#include <signal.h>\n"
"int main () {\n" " return *(signal (0, 0)) (0) == 1\;\n" "}\n")
file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/conftest.cpp ${CONFTEST_RETSIGTYPE})
try_compile(MY_RESULT_VAR ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/conftest.cpp)
if(MY_RESULT_VAR)
set(${VARIABLE} int)
else()
set(${VARIABLE} void)
endif()
file(REMOVE "conftest.cpp")
endmacro()

# =============================================================================
# Perform check_include_files and add it to NRN_HEADERS_INCLUDE_LIST if exist Passing an optional
# CXX will call check_include_files_cxx instead.
Expand Down
3 changes: 0 additions & 3 deletions cmake_nrnconf.h.in
Expand Up @@ -81,9 +81,6 @@
/* Define to the version of this package. */
#cmakedefine PACKAGE_VERSION @PACKAGE_VERSION@

/* Define as the return type of signal handlers (`int' or `void'). */
#cmakedefine RETSIGTYPE @RETSIGTYPE@

/* Define SUNDIALS data type 'realtype' as 'long double' */
#cmakedefine SUNDIALS_DOUBLE_PRECISION @SUNDIALS_DOUBLE_PRECISION@

Expand Down
2 changes: 1 addition & 1 deletion external/iv
16 changes: 8 additions & 8 deletions src/oc/hoc.cpp
Expand Up @@ -188,7 +188,7 @@ static int backslash(int c);
#endif
#if HAS_SIGPIPE
/*ARGSUSED*/
static RETSIGTYPE sigpipe_handler(int sig) {
static void sigpipe_handler(int sig) {
fprintf(stderr, "writing to a broken pipe\n");
signal(SIGPIPE, sigpipe_handler);
}
Expand Down Expand Up @@ -653,7 +653,7 @@ void hoc_execerror(const char* s, const char* t) /* recover from run-time error
hoc_execerror_mes(s, t, hoc_execerror_messages);
}

RETSIGTYPE onintr(int sig) /* catch interrupt */
void onintr(int /* sig */) /* catch interrupt */
{
/*ARGSUSED*/
stoprun = 1;
Expand Down Expand Up @@ -728,7 +728,7 @@ void print_bt() {
#endif
}

RETSIGTYPE fpecatch(int sig) /* catch floating point exceptions */
void fpecatch(int /* sig */) /* catch floating point exceptions */
{
/*ARGSUSED*/
#if DOS
Expand All @@ -746,7 +746,8 @@ RETSIGTYPE fpecatch(int sig) /* catch floating point exceptions */
execerror("Floating point exception.", (char*) 0);
}

RETSIGTYPE sigsegvcatch(int sig) /* segmentation violation probably due to arg type error */
__attribute__((noreturn)) void sigsegvcatch(int /* sig */) /* segmentation violation probably due to
arg type error */
{
Fprintf(stderr, "Segmentation violation\n");
print_bt();
Expand All @@ -758,7 +759,7 @@ RETSIGTYPE sigsegvcatch(int sig) /* segmentation violation probably due to arg t
}

#if HAVE_SIGBUS
RETSIGTYPE sigbuscatch(int sig) {
__attribute__((noreturn)) void sigbuscatch(int /* sig */) {
Fprintf(stderr, "Bus error\n");
print_bt();
/*ARGSUSED*/
Expand Down Expand Up @@ -1170,9 +1171,8 @@ int hoc_moreinput() {
return 1;
}

typedef RETSIGTYPE (*SignalType)(int);

static SignalType signals[4];
using SignalType = void(int);
static SignalType* signals[4];

static void set_signals(void) {
signals[0] = signal(SIGINT, onintr);
Expand Down

0 comments on commit a42c21e

Please sign in to comment.