commit e86ce1f4cd96a51134673f06880c1a606b424354
parent bc27763de2137ee5ad2e83e8affe98a66ca10f5d
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Tue, 18 Apr 2017 14:27:03 +0200
Fix GCC warnings
Diffstat:
3 files changed, 16 insertions(+), 18 deletions(-)
diff --git a/src/parser/solparser_spectrum.c b/src/parser/solparser_spectrum.c
@@ -13,6 +13,8 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. */
+#define _POSIX_C_SOURCE 200112L /* nextafter support */
+
#include "solparser_c.h"
/*******************************************************************************
diff --git a/src/solstice_solve.c b/src/solstice_solve.c
@@ -52,7 +52,7 @@ write_mc_global(struct solstice* solstice, struct ssol_estimator* estimator)
irradiance_factor = 1 / potential;
/* Counts */
- fprintf(solstice->output, "%lu %lu %lu %lu %lu\n",
+ fprintf(solstice->output, "%d %lu %lu %lu %lu\n",
7, /* #global results count */
(unsigned long)htable_receiver_size_get(&solstice->receivers),
(unsigned long)nprimary,
@@ -60,20 +60,16 @@ write_mc_global(struct solstice* solstice, struct ssol_estimator* estimator)
(unsigned long)nfailed);
/* Global data */
- fprintf(solstice->output, "%g %g\n",
- potential, 0.);
- fprintf(solstice->output, "%g %g\n",
- mc_global.absorbed.E, mc_global.absorbed.SE);
- fprintf(solstice->output, "%g %g\n",
- mc_global.cos_factor.E, mc_global.cos_factor.SE);
- fprintf(solstice->output, "%g %g\n",
- mc_global.shadowed.E, mc_global.shadowed.SE);
- fprintf(solstice->output, "%g %g\n",
- mc_global.missing.E, mc_global.missing.SE);
- fprintf(solstice->output, "%g %g\n",
- mc_global.atmosphere.E, mc_global.atmosphere.SE);
- fprintf(solstice->output, "%g %g\n",
- mc_global.reflectivity.E, mc_global.reflectivity.SE);
+ #define PRINT_MC_GLOBAL(Name) \
+ fprintf(solstice->output, "%g %g\n", mc_global.Name.E, mc_global.Name.SE)
+ fprintf(solstice->output, "%g %g\n", potential, 0.);
+ PRINT_MC_GLOBAL(absorbed);
+ PRINT_MC_GLOBAL(cos_factor);
+ PRINT_MC_GLOBAL(shadowed);
+ PRINT_MC_GLOBAL(missing);
+ PRINT_MC_GLOBAL(atmosphere);
+ PRINT_MC_GLOBAL(reflectivity);
+ #undef PRINT_MC_GLOBAL
/* Receivers' data */
htable_receiver_begin(&solstice->receivers, &r_it);
diff --git a/src/test_solstice_simulation.c b/src/test_solstice_simulation.c
@@ -261,7 +261,7 @@ read_recv(FILE* file, char name[], double E[], double SE[])
CHECK(read_line(line, sizeof(line), file), 1);
CHECK(
sscanf(line,
- "%s %*lu %*lg "
+ "%s %*u %*g "
"FRONT: %lg %lg %lg %lg %lg %lg %lg %lg %lg %lg "
" BACK: %lg %lg %lg %lg %lg %lg %lg %lg %lg %lg",
name, /* ID, area */
@@ -295,8 +295,8 @@ read_primary
CHECK(read_line(line, sizeof(line), file), 1);
CHECK(
sscanf(line,
- "%s %*lu "
- "%lg %lg %*lu "
+ "%s %*u "
+ "%lg %lg %*u "
"%lg %lg\n",
name, /* ID */
area, cos, /* count */