From 6588bc6bb26978a1bcb9fc0e2d3483af95d2e90e Mon Sep 17 00:00:00 2001 From: Robert Izzard <r.izzard@surrey.ac.uk> Date: Fri, 13 Dec 2019 09:54:45 +0000 Subject: [PATCH] added checks for strerror back so build works on a mac --- src/perl/scripts2/template.pl | 5 +- src/setup/cmd_line_function_macros.h | 71 +++++++++++++++++++--------- 2 files changed, 53 insertions(+), 23 deletions(-) diff --git a/src/perl/scripts2/template.pl b/src/perl/scripts2/template.pl index 35f47c2b7..e5cf57e7d 100755 --- a/src/perl/scripts2/template.pl +++ b/src/perl/scripts2/template.pl @@ -102,6 +102,9 @@ $population->set( ); +print Data::Dumper::Dumper($population->evcode_args_list()); +exit; + ############################################################ # scan command line arguments for extra options $population->parse_args(); @@ -273,7 +276,7 @@ if(0){ # uncomment this to show version information #print $population->evcode_version_string(); -# uncomment this to show the evcode's args list +# uncomment this to show the evcode's default args list #print join("\n",@{$population->evcode_args_list()}); # evolution the stellar population (this takes some time) diff --git a/src/setup/cmd_line_function_macros.h b/src/setup/cmd_line_function_macros.h index e3ad53a4f..c682efbfe 100644 --- a/src/setup/cmd_line_function_macros.h +++ b/src/setup/cmd_line_function_macros.h @@ -24,19 +24,33 @@ if(errno) \ { \ char errstring[100]; \ - strerror_r(errnum,errstring,100); \ - Exit_binary_c( \ - BINARY_C_UNDER_OR_OVERFLOW, \ - "Argument %d (string %s after %s) has caused a floating point %sflow (errno = %d which is %s)\n", \ - c, \ - argv[c], \ - argv[c-1], \ - ((test<0.0)?"under":"over"), \ - errnum, \ - errstring); \ + if(strerror_r(errnum,errstring,100)) \ + { \ + Exit_binary_c( \ + BINARY_C_UNDER_OR_OVERFLOW, \ + "Argument %d (string %s after %s) has caused a floating point %sflow (errno = %d which is %s)\n", \ + c, \ + argv[c], \ + argv[c-1], \ + ((test<0.0)?"under":"over"), \ + errnum, \ + errstring); \ + } \ + else \ + { \ + Exit_binary_c( \ + BINARY_C_UNDER_OR_OVERFLOW, \ + "Argument %d (string %s after %s) has caused a floating point %sflow (errno = %d, error string unavailable - strerror failed)\n", \ + c, \ + argv[c], \ + argv[c-1], \ + ((test<0.0)?"under":"over"), \ + errnum \ + ); \ + } \ + *((double*) a->pointer) = a->modulate * test; \ + __match=TRUE; \ } \ - *((double*) a->pointer) = a->modulate * test; \ - __match=TRUE; \ } \ else \ { \ @@ -189,16 +203,29 @@ if(errno) \ { \ char errstring[100]; \ - strerror_r(errnum,errstring,100); \ - Exit_binary_c( \ - BINARY_C_UNDER_OR_OVERFLOW, \ - "Argument %d (string %s after %s) has caused a floating point %sflow (errno = %d which is %s)\n", \ - c, \ - argv[c], \ - argv[c-1], \ - ((test<0.0)?"under":"over"), \ - errnum, \ - errstring); \ + if(strerror_r(errnum,errstring,100)) \ + { \ + Exit_binary_c( \ + BINARY_C_UNDER_OR_OVERFLOW, \ + "Argument %d (string %s after %s) has caused a floating point %sflow (errno = %d which is %s)\n", \ + c, \ + argv[c], \ + argv[c-1], \ + ((test<0.0)?"under":"over"), \ + errnum, \ + errstring); \ + } \ + else \ + { \ + Exit_binary_c( \ + BINARY_C_UNDER_OR_OVERFLOW, \ + "Argument %d (string %s after %s) has caused a floating point %sflow (errno = %d, error string unavailable because strerror failed)\n", \ + c, \ + argv[c], \ + argv[c-1], \ + ((test<0.0)?"under":"over"), \ + errnum); \ + } \ } \ *((double*)cmd_line_args[i].pointer + offset) = \ (double)test; \ -- GitLab