From 897da8f26d941a8ceb8f6d131d2a13198d19298f Mon Sep 17 00:00:00 2001 From: Roland Schulz Date: Wed, 10 Sep 2014 21:08:59 -0400 Subject: [PATCH] Fix ICC warnings - 111: statement is unreachable - 181: printf/scanf argument type invalid Change-Id: I28477bdd5734f34ae4deed09b9cddce922469f81 --- cmake/gmxCFlags.cmake | 12 ++-- src/external/thread_mpi/src/pthreads.c | 3 +- src/external/tng_io/include/tng/tng_io.h | 3 + src/external/tng_io/src/lib/tng_io.c | 74 ++++++++++++------------ src/gromacs/fft/fft5d.cpp | 8 +-- src/gromacs/fileio/gmxfio_asc.c | 7 ++- src/gromacs/fileio/libxdrf.c | 5 -- src/gromacs/fileio/pdbio.c | 2 +- src/gromacs/gmxana/gmx_confrms.c | 6 +- src/gromacs/gmxana/gmx_editconf.c | 2 +- src/gromacs/gmxana/gmx_hbond.c | 10 ++-- src/gromacs/gmxana/gmx_sham.c | 2 +- src/gromacs/gmxana/gmx_trjconv.c | 2 +- src/gromacs/gmxlib/txtdump.c | 2 +- src/gromacs/gmxpreprocess/topio.c | 2 +- src/gromacs/gmxpreprocess/vsite_parm.c | 34 +++++------ src/gromacs/mdlib/shakef.c | 4 +- src/gromacs/pbcutil/mshift.cpp | 2 +- src/gromacs/tools/compare.c | 4 +- 19 files changed, 91 insertions(+), 93 deletions(-) diff --git a/cmake/gmxCFlags.cmake b/cmake/gmxCFlags.cmake index 1e675f72f7..011cada36e 100644 --- a/cmake/gmxCFlags.cmake +++ b/cmake/gmxCFlags.cmake @@ -148,9 +148,7 @@ MACRO(gmx_c_flags) GMX_TEST_CFLAG(CFLAGS_PRAGMA "-wd161" GMXC_CFLAGS) endif() endif() -# 111: statement is unreachable -# 177: function ".." was declared but never referenced -# 181: argument of type ".." is incompatible with format "..", expecting argument of type ".." +# 177: function/variable ".." was declared but never referenced # 193: zero used for undefined preprocessing identifier ".." # 271: trailing comma is nonstandard # 304: access control not specified ("public" by default) @@ -173,7 +171,7 @@ MACRO(gmx_c_flags) #3346: dynamic exception specifications are deprecated #11074: Inlining inhibited by limit max-size(/max-total-size) #11076: To get full report use -opt-report=3 -opt-report-phase ipo (shown for previous remark) - GMX_TEST_CFLAG(CFLAGS_WARN "-w3 -wd111 -wd177 -wd181 -wd193 -wd271 -wd304 -wd383 -wd424 -wd444 -wd522 -wd593 -wd869 -wd981 -wd1418 -wd1419 -wd1572 -wd1599 -wd2259 -wd2415 -wd2547 -wd2557 -wd3280 -wd3346 -wd11074 -wd11076" GMXC_CFLAGS) + GMX_TEST_CFLAG(CFLAGS_WARN "-w3 -wd177 -wd193 -wd271 -wd304 -wd383 -wd424 -wd444 -wd522 -wd593 -wd869 -wd981 -wd1418 -wd1419 -wd1572 -wd1599 -wd2259 -wd2415 -wd2547 -wd2557 -wd3280 -wd3346 -wd11074 -wd11076" GMXC_CFLAGS) GMX_TEST_CFLAG(CFLAGS_STDGNU "-std=gnu99" GMXC_CFLAGS) GMX_TEST_CFLAG(CFLAGS_OPT "-ip -funroll-all-loops -alias-const -ansi-alias" GMXC_CFLAGS_RELEASE) else() @@ -184,7 +182,7 @@ MACRO(gmx_c_flags) GMX_TEST_CFLAG(CFLAGS_PRAGMA "/wd161" GMXC_CFLAGS) endif() endif() - GMX_TEST_CFLAG(CFLAGS_WARN "/W3 /wd111 /wd177 /wd181 /wd193 /wd271 /wd304 /wd383 /wd424 /wd444 /wd522 /wd593 /wd869 /wd981 /wd1418 /wd1419 /wd1572 /wd1599 /wd2259 /wd2415 /wd2547 /wd2557 /wd3280 /wd3346" GMXC_CFLAGS) + GMX_TEST_CFLAG(CFLAGS_WARN "/W3 /wd177 /wd193 /wd271 /wd304 /wd383 /wd424 /wd444 /wd522 /wd593 /wd869 /wd981 /wd1418 /wd1419 /wd1572 /wd1599 /wd2259 /wd2415 /wd2547 /wd2557 /wd3280 /wd3346" GMXC_CFLAGS) GMX_TEST_CFLAG(CFLAGS_OPT "/Qip" GMXC_CFLAGS_RELEASE) endif() endif() @@ -201,7 +199,7 @@ MACRO(gmx_c_flags) #All but the following warnings are identical for the C-compiler (see above) #1782: #pragma once is obsolete #2282: unrecognized GCC pragma - GMX_TEST_CXXFLAG(CXXFLAGS_WARN "-w3 -wd111 -wd177 -wd181 -wd193 -wd271 -wd304 -wd383 -wd424 -wd444 -wd522 -wd593 -wd869 -wd981 -wd1418 -wd1419 -wd1572 -wd1599 -wd2259 -wd2415 -wd2547 -wd2557 -wd3280 -wd3346 -wd11074 -wd11076 -wd1782 -wd2282" GMXC_CXXFLAGS) + GMX_TEST_CXXFLAG(CXXFLAGS_WARN "-w3 -wd177 -wd193 -wd271 -wd304 -wd383 -wd424 -wd444 -wd522 -wd593 -wd869 -wd981 -wd1418 -wd1419 -wd1572 -wd1599 -wd2259 -wd2415 -wd2547 -wd2557 -wd3280 -wd3346 -wd11074 -wd11076 -wd1782 -wd2282" GMXC_CXXFLAGS) GMX_TEST_CXXFLAG(CXXFLAGS_OPT "-ip -funroll-all-loops -alias-const -ansi-alias" GMXC_CXXFLAGS_RELEASE) else() if(NOT GMX_OPENMP) @@ -211,7 +209,7 @@ MACRO(gmx_c_flags) GMX_TEST_CXXFLAG(CXXFLAGS_PRAGMA "/wd161" GMXC_CXXFLAGS) endif() endif() - GMX_TEST_CXXFLAG(CXXFLAGS_WARN "/W3 /wd111 /wd177 /wd181 /wd193 /wd271 /wd304 /wd383 /wd424 /wd444 /wd522 /wd593 /wd869 /wd981 /wd1418 /wd1419 /wd1572 /wd1599 /wd2259 /wd2415 /wd2547 /wd2557 /wd3280 /wd3346 /wd1782 /wd2282" GMXC_CXXFLAGS) + GMX_TEST_CXXFLAG(CXXFLAGS_WARN "/W3 /wd177 /wd193 /wd271 /wd304 /wd383 /wd424 /wd444 /wd522 /wd593 /wd869 /wd981 /wd1418 /wd1419 /wd1572 /wd1599 /wd2259 /wd2415 /wd2547 /wd2557 /wd3280 /wd3346 /wd1782 /wd2282" GMXC_CXXFLAGS) GMX_TEST_CXXFLAG(CXXFLAGS_OPT "/Qip" GMXC_CXXFLAGS_RELEASE) endif() endif() diff --git a/src/external/thread_mpi/src/pthreads.c b/src/external/thread_mpi/src/pthreads.c index 3aee9c52e5..0c34919e75 100644 --- a/src/external/thread_mpi/src/pthreads.c +++ b/src/external/thread_mpi/src/pthreads.c @@ -372,8 +372,9 @@ int tMPI_Thread_setaffinity_single(tMPI_Thread_t tmpi_unused thread, CPU_ZERO(&set); CPU_SET(nr, &set); return pthread_setaffinity_np(thread->th, sizeof(set), &set); -#endif +#else return 0; +#endif } diff --git a/src/external/tng_io/include/tng/tng_io.h b/src/external/tng_io/include/tng/tng_io.h index 51c1d9b593..c607aad2c5 100644 --- a/src/external/tng_io/include/tng/tng_io.h +++ b/src/external/tng_io/include/tng/tng_io.h @@ -331,6 +331,9 @@ typedef unsigned __int64 uint64_t; #ifndef PRId64 # define PRId64 __PRI64_PREFIX "d" #endif +#ifndef PRIu64 +# define PRIu64 __PRI64_PREFIX "u" +#endif #endif diff --git a/src/external/tng_io/src/lib/tng_io.c b/src/external/tng_io/src/lib/tng_io.c index 074b781317..7702d23846 100644 --- a/src/external/tng_io/src/lib/tng_io.c +++ b/src/external/tng_io/src/lib/tng_io.c @@ -3222,7 +3222,7 @@ static tng_function_status tng_molecules_block_read sizeof(struct tng_molecule)); if(!tng_data->molecules) { - fprintf(stderr, "TNG library: Cannot allocate memory (%"PRId64" bytes). %s: %d\n", + fprintf(stderr, "TNG library: Cannot allocate memory (%"PRIu64" bytes). %s: %d\n", tng_data->n_molecules * sizeof(struct tng_molecule), __FILE__, __LINE__); return(TNG_CRITICAL); @@ -3238,7 +3238,7 @@ static tng_function_status tng_molecules_block_read tng_data->n_molecules); if(!tng_data->molecule_cnt_list) { - fprintf(stderr, "TNG library: Cannot allocate memory (%"PRId64" bytes). %s: %d\n", + fprintf(stderr, "TNG library: Cannot allocate memory (%"PRIu64" bytes). %s: %d\n", tng_data->n_molecules * sizeof(struct tng_molecule), __FILE__, __LINE__); return(TNG_CRITICAL); @@ -3354,7 +3354,7 @@ static tng_function_status tng_molecules_block_read sizeof(struct tng_chain)); if(!molecule->chains) { - fprintf(stderr, "TNG library: Cannot allocate memory (%"PRId64" bytes). %s: %d\n", + fprintf(stderr, "TNG library: Cannot allocate memory (%"PRIu64" bytes). %s: %d\n", molecule->n_chains * sizeof(struct tng_chain), __FILE__, __LINE__); return(TNG_CRITICAL); @@ -3373,7 +3373,7 @@ static tng_function_status tng_molecules_block_read sizeof(struct tng_residue)); if(!molecule->residues) { - fprintf(stderr, "TNG library: Cannot allocate memory (%"PRId64" bytes). %s: %d\n", + fprintf(stderr, "TNG library: Cannot allocate memory (%"PRIu64" bytes). %s: %d\n", molecule->n_residues * sizeof(struct tng_residue), __FILE__, __LINE__); if(molecule->chains) @@ -3395,7 +3395,7 @@ static tng_function_status tng_molecules_block_read sizeof(struct tng_atom)); if(!molecule->atoms) { - fprintf(stderr, "TNG library: Cannot allocate memory (%"PRId64" bytes). %s: %d\n", + fprintf(stderr, "TNG library: Cannot allocate memory (%"PRIu64" bytes). %s: %d\n", molecule->n_atoms * sizeof(struct tng_atom), __FILE__, __LINE__); if(molecule->chains) @@ -3503,7 +3503,7 @@ static tng_function_status tng_molecules_block_read sizeof(struct tng_bond)); if(!molecule->bonds) { - fprintf(stderr, "TNG library: Cannot allocate memory (%"PRId64" bytes). %s: %d\n", + fprintf(stderr, "TNG library: Cannot allocate memory (%"PRIu64" bytes). %s: %d\n", molecule->n_bonds * sizeof(struct tng_bond), __FILE__, __LINE__); if(molecule->chains) @@ -3997,7 +3997,7 @@ static tng_function_status tng_frame_set_block_read if(!frame_set->molecule_cnt_list) { - fprintf(stderr, "TNG library: Cannot allocate memory (%"PRId64" bytes). %s: %d\n", + fprintf(stderr, "TNG library: Cannot allocate memory (%"PRIu64" bytes). %s: %d\n", sizeof(int64_t) * tng_data->n_molecules, __FILE__, __LINE__); return(TNG_CRITICAL); @@ -4199,7 +4199,7 @@ static tng_function_status tng_frame_set_block_write temp_name = realloc(block->name, name_len + 1); if(!temp_name) { - fprintf(stderr, "TNG library: Cannot allocate memory (%d bytes). %s: %d\n", + fprintf(stderr, "TNG library: Cannot allocate memory (%u bytes). %s: %d\n", name_len+1, __FILE__, __LINE__); free(block->name); block->name = 0; @@ -4538,7 +4538,7 @@ static tng_function_status tng_trajectory_mapping_block_read sizeof(int64_t)); if(!mapping->real_particle_numbers) { - fprintf(stderr, "TNG library: Cannot allocate memory (%"PRId64" bytes). %s: %d\n", + fprintf(stderr, "TNG library: Cannot allocate memory (%"PRIu64" bytes). %s: %d\n", mapping->n_particles * sizeof(int64_t), __FILE__, __LINE__); return(TNG_CRITICAL); } @@ -4614,7 +4614,7 @@ static tng_function_status tng_trajectory_mapping_block_write temp_name = realloc(block->name, name_len + 1); if(!temp_name) { - fprintf(stderr, "TNG library: Cannot allocate memory (%d bytes). %s: %d\n", + fprintf(stderr, "TNG library: Cannot allocate memory (%u bytes). %s: %d\n", name_len+1, __FILE__, __LINE__); free(block->name); block->name = 0; @@ -5190,7 +5190,7 @@ static tng_function_status tng_gzip_compress(tng_trajectory_t tng_data, dest = malloc(max_len); if(!dest) { - fprintf(stderr, "TNG library: Cannot allocate memory (%ld bytes). %s: %d\n", + fprintf(stderr, "TNG library: Cannot allocate memory (%lu bytes). %s: %d\n", max_len, __FILE__, __LINE__); return(TNG_CRITICAL); } @@ -5365,7 +5365,7 @@ static tng_function_status tng_allocate_particle_data_mem n_particles); if(!data->strings[i]) { - fprintf(stderr, "TNG library: Cannot allocate memory (%"PRId64" bytes). %s: %d\n", + fprintf(stderr, "TNG library: Cannot allocate memory (%"PRIu64" bytes). %s: %d\n", sizeof(union data_values *) * n_particles, __FILE__, __LINE__); return(TNG_CRITICAL); @@ -5376,7 +5376,7 @@ static tng_function_status tng_allocate_particle_data_mem n_values_per_frame); if(!data->strings[i][j]) { - fprintf(stderr, "TNG library: Cannot allocate memory (%"PRId64" bytes). %s: %d\n", + fprintf(stderr, "TNG library: Cannot allocate memory (%"PRIu64" bytes). %s: %d\n", sizeof(union data_values) * n_values_per_frame, __FILE__, __LINE__); return(TNG_CRITICAL); @@ -6907,7 +6907,7 @@ static tng_function_status tng_data_block_write(tng_trajectory_t tng_data, temp_name = realloc(block->name, len); if(!temp_name) { - fprintf(stderr, "TNG library: Cannot allocate memory (%d bytes). %s: %d\n", len+1, + fprintf(stderr, "TNG library: Cannot allocate memory (%u bytes). %s: %d\n", len+1, __FILE__, __LINE__); free(block->name); block->name = 0; @@ -8009,7 +8009,7 @@ tng_function_status DECLSPECDLLEXPORT tng_molecule_w_id_add if(!new_molecules) { - fprintf(stderr, "TNG library: Cannot allocate memory (%"PRId64" bytes). %s: %d\n", + fprintf(stderr, "TNG library: Cannot allocate memory (%"PRIu64" bytes). %s: %d\n", sizeof(struct tng_molecule) * (tng_data->n_molecules + 1), __FILE__, __LINE__); free(tng_data->molecules); @@ -8023,7 +8023,7 @@ tng_function_status DECLSPECDLLEXPORT tng_molecule_w_id_add if(!new_molecule_cnt_list) { - fprintf(stderr, "TNG library: Cannot allocate memory (%"PRId64" bytes). %s: %d\n", + fprintf(stderr, "TNG library: Cannot allocate memory (%"PRIu64" bytes). %s: %d\n", sizeof(int64_t) * (tng_data->n_molecules + 1), __FILE__, __LINE__); free(tng_data->molecule_cnt_list); @@ -8075,7 +8075,7 @@ tng_function_status DECLSPECDLLEXPORT tng_molecule_existing_add if(!new_molecules) { - fprintf(stderr, "TNG library: Cannot allocate memory (%"PRId64" bytes). %s: %d\n", + fprintf(stderr, "TNG library: Cannot allocate memory (%"PRIu64" bytes). %s: %d\n", sizeof(struct tng_molecule) * (tng_data->n_molecules + 1), __FILE__, __LINE__); free(tng_data->molecules); @@ -8089,7 +8089,7 @@ tng_function_status DECLSPECDLLEXPORT tng_molecule_existing_add if(!new_molecule_cnt_list) { - fprintf(stderr, "TNG library: Cannot allocate memory (%"PRId64" bytes). %s: %d\n", + fprintf(stderr, "TNG library: Cannot allocate memory (%"PRIu64" bytes). %s: %d\n", sizeof(int64_t) * (tng_data->n_molecules + 1), __FILE__, __LINE__); free(tng_data->molecule_cnt_list); @@ -8320,7 +8320,7 @@ tng_function_status DECLSPECDLLEXPORT tng_molecule_system_copy(tng_trajectory_t sizeof(struct tng_molecule) * tng_data_src->n_molecules); if(!molecule_temp) { - fprintf(stderr, "TNG library: Cannot allocate memory (%"PRId64" bytes). %s: %d\n", + fprintf(stderr, "TNG library: Cannot allocate memory (%"PRIu64" bytes). %s: %d\n", sizeof(struct tng_molecule) * tng_data_src->n_molecules, __FILE__, __LINE__); free(tng_data_dest->molecules); @@ -8331,7 +8331,7 @@ tng_function_status DECLSPECDLLEXPORT tng_molecule_system_copy(tng_trajectory_t sizeof(int64_t) * tng_data_src->n_molecules); if(!list_temp) { - fprintf(stderr, "TNG library: Cannot allocate memory (%"PRId64" bytes). %s: %d\n", + fprintf(stderr, "TNG library: Cannot allocate memory (%"PRIu64" bytes). %s: %d\n", sizeof(int64_t) * tng_data_src->n_molecules, __FILE__, __LINE__); free(tng_data_dest->molecule_cnt_list); @@ -8401,7 +8401,7 @@ tng_function_status DECLSPECDLLEXPORT tng_molecule_system_copy(tng_trajectory_t molecule->n_bonds); if(!bond_temp) { - fprintf(stderr, "TNG library: Cannot allocate memory (%"PRId64" bytes). %s: %d\n", + fprintf(stderr, "TNG library: Cannot allocate memory (%"PRIu64" bytes). %s: %d\n", sizeof(struct tng_bond) * molecule->n_bonds, __FILE__, __LINE__); free(molecule_temp->bonds); @@ -8601,7 +8601,7 @@ tng_function_status DECLSPECDLLEXPORT tng_molecule_chain_w_id_add if(!new_chains) { - fprintf(stderr, "TNG library: Cannot allocate memory (%"PRId64" bytes). %s: %d\n", + fprintf(stderr, "TNG library: Cannot allocate memory (%"PRIu64" bytes). %s: %d\n", sizeof(struct tng_chain) * (molecule->n_chains + 1), __FILE__, __LINE__); free(molecule->chains); @@ -8642,7 +8642,7 @@ tng_function_status DECLSPECDLLEXPORT tng_molecule_bond_add if(!new_bonds) { - fprintf(stderr, "TNG library: Cannot allocate memory (%"PRId64" bytes). %s: %d\n", + fprintf(stderr, "TNG library: Cannot allocate memory (%"PRIu64" bytes). %s: %d\n", sizeof(struct tng_bond) * (molecule->n_bonds + 1), __FILE__, __LINE__); *bond = 0; @@ -8867,7 +8867,7 @@ tng_function_status DECLSPECDLLEXPORT tng_chain_residue_w_id_add if(!new_residues) { - fprintf(stderr, "TNG library: Cannot allocate memory (%"PRId64" bytes). %s: %d\n", + fprintf(stderr, "TNG library: Cannot allocate memory (%"PRIu64" bytes). %s: %d\n", sizeof(struct tng_residue) * (molecule->n_residues + 1), __FILE__, __LINE__); free(molecule->residues); @@ -9079,7 +9079,7 @@ tng_function_status DECLSPECDLLEXPORT tng_residue_atom_w_id_add if(!new_atoms) { - fprintf(stderr, "TNG library: Cannot allocate memory (%"PRId64" bytes). %s: %d\n", + fprintf(stderr, "TNG library: Cannot allocate memory (%"PRIu64" bytes). %s: %d\n", sizeof(struct tng_atom) * (molecule->n_atoms + 1), __FILE__, __LINE__); free(molecule->atoms); @@ -9343,14 +9343,14 @@ tng_function_status DECLSPECDLLEXPORT tng_molsystem_bonds_get *from_atoms = malloc(sizeof(int64_t) * (*n_bonds)); if(!*from_atoms) { - fprintf(stderr, "TNG library: Cannot allocate memory (%"PRId64" bytes). %s: %d\n", + fprintf(stderr, "TNG library: Cannot allocate memory (%"PRIu64" bytes). %s: %d\n", sizeof(int64_t) * (*n_bonds), __FILE__, __LINE__); return(TNG_CRITICAL); } *to_atoms = malloc(sizeof(int64_t) * (*n_bonds)); if(!*to_atoms) { - fprintf(stderr, "TNG library: Cannot allocate memory (%"PRId64" bytes). %s: %d\n", + fprintf(stderr, "TNG library: Cannot allocate memory (%"PRIu64" bytes). %s: %d\n", sizeof(int64_t) * (*n_bonds), __FILE__, __LINE__); free(*from_atoms); *from_atoms = 0; @@ -9732,7 +9732,7 @@ tng_function_status DECLSPECDLLEXPORT tng_particle_mapping_add if(!mapping) { - fprintf(stderr, "TNG library: Cannot allocate memory (%"PRId64" bytes). %s: %d\n", + fprintf(stderr, "TNG library: Cannot allocate memory (%"PRIu64" bytes). %s: %d\n", sizeof(struct tng_particle_mapping)*frame_set->n_mapping_blocks, __FILE__, __LINE__); free(frame_set->mappings); @@ -9747,7 +9747,7 @@ tng_function_status DECLSPECDLLEXPORT tng_particle_mapping_add frame_set->mappings[frame_set->n_mapping_blocks - 1].real_particle_numbers = malloc(sizeof(int64_t) * n_particles); if(!frame_set->mappings[frame_set->n_mapping_blocks - 1].real_particle_numbers) { - fprintf(stderr, "TNG library: Cannot allocate memory (%"PRId64" bytes). %s: %d\n", + fprintf(stderr, "TNG library: Cannot allocate memory (%"PRIu64" bytes). %s: %d\n", sizeof(int64_t) * n_particles, __FILE__, __LINE__); return(TNG_CRITICAL); } @@ -15113,7 +15113,7 @@ static tng_function_status tng_data_values_alloc *values = malloc(sizeof(union data_values *) * n_frames); if(!*values) { - fprintf(stderr, "TNG library: Cannot allocate memory (%"PRId64" bytes). %s: %d\n", + fprintf(stderr, "TNG library: Cannot allocate memory (%"PRIu64" bytes). %s: %d\n", sizeof(union data_values **) * n_frames, __FILE__, __LINE__); return(TNG_CRITICAL); @@ -15126,7 +15126,7 @@ static tng_function_status tng_data_values_alloc n_values_per_frame); if(!(*values)[i]) { - fprintf(stderr, "TNG library: Cannot allocate memory (%"PRId64" bytes). %s: %d\n", + fprintf(stderr, "TNG library: Cannot allocate memory (%"PRIu64" bytes). %s: %d\n", sizeof(union data_values) * n_values_per_frame, __FILE__, __LINE__); free(values); @@ -15207,7 +15207,7 @@ static tng_function_status tng_particle_data_values_alloc *values = malloc(sizeof(union data_values **) * n_frames); if(!*values) { - fprintf(stderr, "TNG library: Cannot allocate memory (%"PRId64" bytes). %s: %d\n", + fprintf(stderr, "TNG library: Cannot allocate memory (%"PRIu64" bytes). %s: %d\n", sizeof(union data_values **) * n_frames, __FILE__, __LINE__); return(TNG_CRITICAL); @@ -15220,7 +15220,7 @@ static tng_function_status tng_particle_data_values_alloc n_particles); if(!(*values)[i]) { - fprintf(stderr, "TNG library: Cannot allocate memory (%"PRId64" bytes). %s: %d\n", + fprintf(stderr, "TNG library: Cannot allocate memory (%"PRIu64" bytes). %s: %d\n", sizeof(union data_values *) * n_particles, __FILE__, __LINE__); free(*values); @@ -15233,7 +15233,7 @@ static tng_function_status tng_particle_data_values_alloc n_values_per_frame); if(!(*values)[i][j]) { - fprintf(stderr, "TNG library: Cannot allocate memory (%"PRId64" bytes). %s: %d\n", + fprintf(stderr, "TNG library: Cannot allocate memory (%"PRIu64" bytes). %s: %d\n", sizeof(union data_values *) * n_particles, __FILE__, __LINE__); tng_particle_data_values_free(tng_data, *values, n_frames, @@ -19163,7 +19163,7 @@ tng_function_status DECLSPECDLLEXPORT tng_util_trajectory_next_frame_present_dat temp = realloc(*data_block_ids_in_next_frame, size); if(!temp) { - fprintf(stderr, "TNG library: Cannot allocate memory (%"PRId64" bytes). %s: %d\n", + fprintf(stderr, "TNG library: Cannot allocate memory (%"PRIu64" bytes). %s: %d\n", sizeof(int64_t) * (*n_data_blocks_in_next_frame), __FILE__, __LINE__); free(*data_block_ids_in_next_frame); @@ -19305,7 +19305,7 @@ tng_function_status DECLSPECDLLEXPORT tng_util_trajectory_next_frame_present_dat temp = realloc(*data_block_ids_in_next_frame, size); if(!temp) { - fprintf(stderr, "TNG library: Cannot allocate memory (%"PRId64" bytes). %s: %d\n", + fprintf(stderr, "TNG library: Cannot allocate memory (%"PRIu64" bytes). %s: %d\n", sizeof(int64_t) * (*n_data_blocks_in_next_frame), __FILE__, __LINE__); free(*data_block_ids_in_next_frame); @@ -19392,7 +19392,7 @@ tng_function_status DECLSPECDLLEXPORT tng_util_trajectory_next_frame_present_dat temp = realloc(*data_block_ids_in_next_frame, size); if(!temp) { - fprintf(stderr, "TNG library: Cannot allocate memory (%"PRId64" bytes). %s: %d\n", + fprintf(stderr, "TNG library: Cannot allocate memory (%"PRIu64" bytes). %s: %d\n", sizeof(int64_t) * (*n_data_blocks_in_next_frame), __FILE__, __LINE__); free(*data_block_ids_in_next_frame); diff --git a/src/gromacs/fft/fft5d.cpp b/src/gromacs/fft/fft5d.cpp index d226622916..93f518a85b 100644 --- a/src/gromacs/fft/fft5d.cpp +++ b/src/gromacs/fft/fft5d.cpp @@ -1005,7 +1005,7 @@ void fft5d_execute(fft5d_plan plan, int thread, fft5d_time times) s = 0; /*lin: x,y,z*/ - if (plan->flags&FFT5D_DEBUG && thread == 0) + if ((plan->flags&FFT5D_DEBUG) && thread == 0) { print_localdata(lin, "%d %d: copy in lin\n", s, plan); } @@ -1065,7 +1065,7 @@ void fft5d_execute(fft5d_plan plan, int thread, fft5d_time times) time_fft += MPI_Wtime()-time; } #endif - if (plan->flags&FFT5D_DEBUG && thread == 0) + if ((plan->flags&FFT5D_DEBUG) && thread == 0) { print_localdata(lout, "%d %d: FFT %d\n", s, plan); } @@ -1186,7 +1186,7 @@ void fft5d_execute(fft5d_plan plan, int thread, fft5d_time times) time_local += MPI_Wtime()-time; } #endif - if (plan->flags&FFT5D_DEBUG && thread == 0) + if ((plan->flags&FFT5D_DEBUG) && thread == 0) { print_localdata(lin, "%d %d: tranposed %d\n", s+1, plan); } @@ -1230,7 +1230,7 @@ void fft5d_execute(fft5d_plan plan, int thread, fft5d_time times) } #endif - if (plan->flags&FFT5D_DEBUG && thread == 0) + if ((plan->flags&FFT5D_DEBUG) && thread == 0) { print_localdata(lout, "%d %d: FFT %d\n", s, plan); } diff --git a/src/gromacs/fileio/gmxfio_asc.c b/src/gromacs/fileio/gmxfio_asc.c index 153e345726..f819a8d7a0 100644 --- a/src/gromacs/fileio/gmxfio_asc.c +++ b/src/gromacs/fileio/gmxfio_asc.c @@ -293,8 +293,9 @@ static gmx_bool do_ascread(t_fileio *fio, void *item, int nitem, int eio, int i, m, res = 0, *iptr, ix; gmx_int64_t s; double d, x; + char c; real *ptr; - unsigned char uc, *ucptr; + unsigned char *ucptr; char *cptr; #define NEXT_ITEM_BUF_LEN 128 char ni_buf[NEXT_ITEM_BUF_LEN]; @@ -327,10 +328,10 @@ static gmx_bool do_ascread(t_fileio *fio, void *item, int nitem, int eio, } break; case eioUCHAR: - res = sscanf(next_item(fp, ni_buf, NEXT_ITEM_BUF_LEN), "%c", &uc); + res = sscanf(next_item(fp, ni_buf, NEXT_ITEM_BUF_LEN), "%c", &c); if (item) { - *((unsigned char *) item) = uc; + *((unsigned char *) item) = (unsigned char)c; } break; case eioNUCHAR: diff --git a/src/gromacs/fileio/libxdrf.c b/src/gromacs/fileio/libxdrf.c index 90e58d4ee2..401cfa8883 100644 --- a/src/gromacs/fileio/libxdrf.c +++ b/src/gromacs/fileio/libxdrf.c @@ -1130,7 +1130,6 @@ xtc_get_next_frame_number(FILE *fp, XDR *xdrs, int natoms) } } } - return -1; } @@ -1171,7 +1170,6 @@ static float xtc_get_next_frame_time(FILE *fp, XDR *xdrs, int natoms, return -1; } } - return -1; } @@ -1219,7 +1217,6 @@ xtc_get_current_frame_time(FILE *fp, XDR *xdrs, int natoms, gmx_bool * bOK) } } } - return -1; } /* Currently not used, just for completeness */ @@ -1269,7 +1266,6 @@ xtc_get_current_frame_number(FILE *fp, XDR *xdrs, int natoms, gmx_bool * bOK) } } } - return -1; } @@ -1302,7 +1298,6 @@ static gmx_off_t xtc_get_next_frame_start(FILE *fp, XDR *xdrs, int natoms) return -1; } } - return -1; } diff --git a/src/gromacs/fileio/pdbio.c b/src/gromacs/fileio/pdbio.c index d5b8a00517..20bd556dae 100644 --- a/src/gromacs/fileio/pdbio.c +++ b/src/gromacs/fileio/pdbio.c @@ -392,7 +392,7 @@ void write_pdbfile_indexed(FILE *out, const char *title, if (atoms->pdbinfo && atoms->pdbinfo[i].bAnisotropic) { - fprintf(out, "ANISOU%5u %-4.4s%4.4s%c%4d%c %7d%7d%7d%7d%7d%7d\n", + fprintf(out, "ANISOU%5d %-4.4s%4.4s%c%4d%c %7d%7d%7d%7d%7d%7d\n", (i+1)%100000, nm, resnm, ch, resnr, (resic == '\0') ? ' ' : resic, atoms->pdbinfo[i].uij[0], atoms->pdbinfo[i].uij[1], diff --git a/src/gromacs/gmxana/gmx_confrms.c b/src/gromacs/gmxana/gmx_confrms.c index 3cc6dc6d14..af82b05a04 100644 --- a/src/gromacs/gmxana/gmx_confrms.c +++ b/src/gromacs/gmxana/gmx_confrms.c @@ -611,12 +611,12 @@ int gmx_confrms(int argc, char *argv[]) fprintf(fp, "[ Match_%s_%s ]\n", conf1file, groupnames1); for (i = 0; i < isize1; i++) { - fprintf(fp, "%4u%s", index1[i]+1, (i%15 == 14 || i == isize1-1) ? "\n" : " "); + fprintf(fp, "%4d%s", index1[i]+1, (i%15 == 14 || i == isize1-1) ? "\n" : " "); } fprintf(fp, "[ Match_%s_%s ]\n", conf2file, groupnames2); for (i = 0; i < isize2; i++) { - fprintf(fp, "%4u%s", index2[i]+1, (i%15 == 14 || i == isize2-1) ? "\n" : " "); + fprintf(fp, "%4d%s", index2[i]+1, (i%15 == 14 || i == isize2-1) ? "\n" : " "); } } } @@ -636,7 +636,7 @@ int gmx_confrms(int argc, char *argv[]) if (warn < 20) { fprintf(stderr, - "Warning: atomnames at index %d don't match: %u %s, %u %s\n", + "Warning: atomnames at index %d don't match: %d %s, %d %s\n", i+1, index1[i]+1, name1, index2[i]+1, name2); } warn++; diff --git a/src/gromacs/gmxana/gmx_editconf.c b/src/gromacs/gmxana/gmx_editconf.c index 02069c9945..9fedfee2c8 100644 --- a/src/gromacs/gmxana/gmx_editconf.c +++ b/src/gromacs/gmxana/gmx_editconf.c @@ -340,7 +340,7 @@ void pdb_legend(FILE *out, int natoms, int nres, t_atoms *atoms, rvec x[]) for (i = 1; (i < 12); i++) { fprintf(out, - "%-6s%5u %-4.4s%3.3s %c%4d%c %8.3f%8.3f%8.3f%6.2f%6.2f\n", + "%-6s%5d %-4.4s%3.3s %c%4d%c %8.3f%8.3f%8.3f%6.2f%6.2f\n", "ATOM ", natoms + 1 + i, "CA", "LEG", space, nres + 1, space, (xmin + (i * 0.12)) * 10, ymin * 10, zmin * 10, 1.0, bfac_min + ((i - 1.0) * (bfac_max - bfac_min) / 10)); diff --git a/src/gromacs/gmxana/gmx_hbond.c b/src/gromacs/gmxana/gmx_hbond.c index 06911ed582..5d960071a7 100644 --- a/src/gromacs/gmxana/gmx_hbond.c +++ b/src/gromacs/gmxana/gmx_hbond.c @@ -3386,7 +3386,7 @@ static void dump_hbmap(t_hbdata *hb, for (i = 0; i < isize[grp]; i++) { fprintf(fp, (i%15) ? " " : "\n"); - fprintf(fp, " %4u", index[grp][i]+1); + fprintf(fp, " %4d", index[grp][i]+1); } fprintf(fp, "\n"); /* @@ -3402,7 +3402,7 @@ static void dump_hbmap(t_hbdata *hb, { for (j = 0; (j < hb->d.nhydro[i]); j++) { - fprintf(fp, " %4u %4u", hb->d.don[i]+1, + fprintf(fp, " %4d %4d", hb->d.don[i]+1, hb->d.hydro[i][j]+1); } fprintf(fp, "\n"); @@ -3415,7 +3415,7 @@ static void dump_hbmap(t_hbdata *hb, if (hb->a.grp[i] == grp) { fprintf(fp, (i%15 && !first) ? " " : "\n"); - fprintf(fp, " %4u", hb->a.acc[i]+1); + fprintf(fp, " %4d", hb->a.acc[i]+1); first = FALSE; } } @@ -3446,7 +3446,7 @@ static void dump_hbmap(t_hbdata *hb, sprintf(as, "%s", mkatomname(atoms, aaa)); if (bContact) { - fprintf(fp, " %6u %6u\n", ddd+1, aaa+1); + fprintf(fp, " %6d %6d\n", ddd+1, aaa+1); if (fplog) { fprintf(fplog, "%12s %12s\n", ds, as); @@ -3456,7 +3456,7 @@ static void dump_hbmap(t_hbdata *hb, { hhh = hb->d.hydro[i][m]; sprintf(hs, "%s", mkatomname(atoms, hhh)); - fprintf(fp, " %6u %6u %6u\n", ddd+1, hhh+1, aaa+1); + fprintf(fp, " %6d %6d %6d\n", ddd+1, hhh+1, aaa+1); if (fplog) { fprintf(fplog, "%12s %12s %12s\n", ds, hs, as); diff --git a/src/gromacs/gmxana/gmx_sham.c b/src/gromacs/gmxana/gmx_sham.c index 863e820489..94430c03d9 100644 --- a/src/gromacs/gmxana/gmx_sham.c +++ b/src/gromacs/gmxana/gmx_sham.c @@ -756,7 +756,7 @@ static void do_sham(const char *fn, const char *ndx, index = index3(ibox, i, j, k); if (P[index] > 0) { - fprintf(fp, "%-6s%5u %-4.4s%3.3s %4d %8.3f%8.3f%8.3f%6.2f%6.2f\n", + fprintf(fp, "%-6s%5d %-4.4s%3.3s %4d %8.3f%8.3f%8.3f%6.2f%6.2f\n", "ATOM", (index+1) %10000, "H", "H", (index+1)%10000, xxx[XX], xxx[YY], xxx[ZZ], 1.0, W[index]); } diff --git a/src/gromacs/gmxana/gmx_trjconv.c b/src/gromacs/gmxana/gmx_trjconv.c index 4a0be11681..b687c07220 100644 --- a/src/gromacs/gmxana/gmx_trjconv.c +++ b/src/gromacs/gmxana/gmx_trjconv.c @@ -376,7 +376,7 @@ static void put_residue_com_in_box(int unitcell_enum, int ecenter, { if (debug) { - fprintf(debug, "\nShifting position of residue %d (atoms %u-%u) " + fprintf(debug, "\nShifting position of residue %d (atoms %d-%d) " "by %g,%g,%g\n", atom[res_start].resind+1, res_start+1, res_end+1, shift[XX], shift[YY], shift[ZZ]); } diff --git a/src/gromacs/gmxlib/txtdump.c b/src/gromacs/gmxlib/txtdump.c index 9b3eec687e..a70c1c005c 100644 --- a/src/gromacs/gmxlib/txtdump.c +++ b/src/gromacs/gmxlib/txtdump.c @@ -1411,7 +1411,7 @@ void pr_ilist(FILE *fp, int indent, const char *title, j++; for (k = 0; k < interaction_function[ftype].nratoms; k++) { - (void) fprintf(fp, " %u", *(iatoms++)); + (void) fprintf(fp, " %d", *(iatoms++)); } (void) fprintf(fp, "\n"); i += 1+interaction_function[ftype].nratoms; diff --git a/src/gromacs/gmxpreprocess/topio.c b/src/gromacs/gmxpreprocess/topio.c index ffc95d0596..e09518e8b2 100644 --- a/src/gromacs/gmxpreprocess/topio.c +++ b/src/gromacs/gmxpreprocess/topio.c @@ -995,7 +995,7 @@ static char **read_topol(const char *infile, const char *outfile, break; } default: - fprintf (stderr, "case: %d\n", d); + fprintf (stderr, "case: %d\n", (int)d); gmx_incons("unknown directive"); } } diff --git a/src/gromacs/gmxpreprocess/vsite_parm.c b/src/gromacs/gmxpreprocess/vsite_parm.c index df9f9160ad..5a1088711a 100644 --- a/src/gromacs/gmxpreprocess/vsite_parm.c +++ b/src/gromacs/gmxpreprocess/vsite_parm.c @@ -289,7 +289,7 @@ static void print_bad(FILE *fp, fprintf(fp, "bonds:"); for (i = 0; i < nrbond; i++) { - fprintf(fp, " %u-%u (%g)", + fprintf(fp, " %d-%d (%g)", bonds[i].AI+1, bonds[i].AJ+1, bonds[i].c); } fprintf(fp, "\n"); @@ -299,7 +299,7 @@ static void print_bad(FILE *fp, fprintf(fp, "angles:"); for (i = 0; i < nrang; i++) { - fprintf(fp, " %u-%u-%u (%g)", + fprintf(fp, " %d-%d-%d (%g)", angles[i].AI+1, angles[i].AJ+1, angles[i].AK+1, angles[i].c); } @@ -310,7 +310,7 @@ static void print_bad(FILE *fp, fprintf(fp, "idihs:"); for (i = 0; i < nridih; i++) { - fprintf(fp, " %u-%u-%u-%u (%g)", + fprintf(fp, " %d-%d-%d-%d (%g)", idihs[i].AI+1, idihs[i].AJ+1, idihs[i].AK+1, idihs[i].AL+1, idihs[i].c); } @@ -422,7 +422,7 @@ static gmx_bool calc_vsite3_param(gpp_atomtype_t atype, int i; for (i = 0; i < 4; i++) { - fprintf(debug, "atom %u type %s ", + fprintf(debug, "atom %d type %s ", param->a[i]+1, get_atomtype_name_AB(&at->atom[param->a[i]], atype)); } @@ -493,7 +493,7 @@ static gmx_bool calc_vsite3_param(gpp_atomtype_t atype, if (debug) { - fprintf(debug, "params for vsite3 %u: %g %g\n", + fprintf(debug, "params for vsite3 %d: %g %g\n", param->AI+1, param->C0, param->C1); } @@ -527,7 +527,7 @@ static gmx_bool calc_vsite3fd_param(t_param *param, if (debug) { - fprintf(debug, "params for vsite3fd %u: %g %g\n", + fprintf(debug, "params for vsite3fd %d: %g %g\n", param->AI+1, param->C0, param->C1); } return bError; @@ -562,7 +562,7 @@ static gmx_bool calc_vsite3fad_param(t_param *param, if (debug) { - fprintf(debug, "params for vsite3fad %u: %g %g\n", + fprintf(debug, "params for vsite3fad %d: %g %g\n", param->AI+1, param->C0, param->C1); } return bError; @@ -589,7 +589,7 @@ static gmx_bool calc_vsite3out_param(gpp_atomtype_t atype, int i; for (i = 0; i < 4; i++) { - fprintf(debug, "atom %u type %s ", + fprintf(debug, "atom %d type %s ", param->a[i]+1, get_atomtype_name_AB(&at->atom[param->a[i]], atype)); } fprintf(debug, "\n"); @@ -674,7 +674,7 @@ static gmx_bool calc_vsite3out_param(gpp_atomtype_t atype, } if (debug) { - fprintf(debug, "params for vsite3out %u: %g %g %g\n", + fprintf(debug, "params for vsite3out %d: %g %g %g\n", param->AI+1, param->C0, param->C1, param->C2); } return bError; @@ -732,7 +732,7 @@ static gmx_bool calc_vsite4fd_param(t_param *param, param->C2 = -bij; if (debug) { - fprintf(debug, "params for vsite4fd %u: %g %g %g\n", + fprintf(debug, "params for vsite4fd %d: %g %g %g\n", param->AI+1, param->C0, param->C1, param->C2); } } @@ -795,7 +795,7 @@ calc_vsite4fdn_param(t_param *param, if (debug) { - fprintf(debug, "params for vsite4fdn %u: %g %g %g\n", + fprintf(debug, "params for vsite4fdn %d: %g %g %g\n", param->AI+1, param->C0, param->C1, param->C2); } } @@ -866,7 +866,7 @@ int set_vsites(gmx_bool bVerbose, t_atoms *atoms, gpp_atomtype_t atype, if (debug) { fprintf(debug, "Found %d bonds, %d angles and %d idihs " - "for virtual site %u (%s)\n", nrbond, nrang, nridih, + "for virtual site %d (%s)\n", nrbond, nrang, nridih, plist[ftype].param[i].AI+1, interaction_function[ftype].longname); print_bad(debug, nrbond, bonds, nrang, angles, nridih, idihs); @@ -998,7 +998,7 @@ static void check_vsite_constraints(t_params *plist, atom = ps->param[i].a[k]; if (vsite_type[atom] != NOTSET) { - fprintf(stderr, "ERROR: Cannot have constraint (%u-%u) with virtual site (%u)\n", + fprintf(stderr, "ERROR: Cannot have constraint (%d-%d) with virtual site (%d)\n", ps->param[i].AI+1, ps->param[i].AJ+1, atom+1); n++; } @@ -1040,7 +1040,7 @@ static void clean_vsite_bonds(t_params *plist, t_pindex pindex[], nvsite = 0; if (debug) { - fprintf(debug, "constr %u %u:", ps->param[i].AI+1, ps->param[i].AJ+1); + fprintf(debug, "constr %d %d:", ps->param[i].AI+1, ps->param[i].AJ+1); } for (k = 0; (k < 2) && !bKeep && !bRemove; k++) { @@ -1437,10 +1437,10 @@ static void clean_vsite_dihs(t_params *plist, t_pindex pindex[], } if (debug) { - fprintf(debug, "dih w. vsite: %u %u %u %u\n", + fprintf(debug, "dih w. vsite: %d %d %d %d\n", ps->param[i].AI+1, ps->param[i].AJ+1, ps->param[i].AK+1, ps->param[i].AL+1); - fprintf(debug, "vsite %u from: %u %u %u\n", + fprintf(debug, "vsite %d from: %d %d %d\n", atom+1, vsiteatoms[0]+1, vsiteatoms[1]+1, vsiteatoms[2]+1); } } @@ -1499,7 +1499,7 @@ static void clean_vsite_dihs(t_params *plist, t_pindex pindex[], bKeep = TRUE; if (debug) { - fprintf(debug, "unused atom in dih: %u\n", atom+1); + fprintf(debug, "unused atom in dih: %d\n", atom+1); } } } diff --git a/src/gromacs/mdlib/shakef.c b/src/gromacs/mdlib/shakef.c index 7ee7dbe2a8..46030d0cbc 100644 --- a/src/gromacs/mdlib/shakef.c +++ b/src/gromacs/mdlib/shakef.c @@ -261,11 +261,11 @@ int vec_shakef(FILE *fplog, gmx_shakedata_t shaked, if (fplog) { fprintf(fplog, "Inner product between old and new vector <= 0.0!\n" - "constraint #%d atoms %u and %u\n", + "constraint #%d atoms %d and %d\n", error-1, iatom[3*(error-1)+1]+1, iatom[3*(error-1)+2]+1); } fprintf(stderr, "Inner product between old and new vector <= 0.0!\n" - "constraint #%d atoms %u and %u\n", + "constraint #%d atoms %d and %d\n", error-1, iatom[3*(error-1)+1]+1, iatom[3*(error-1)+2]+1); nit = 0; } diff --git a/src/gromacs/pbcutil/mshift.cpp b/src/gromacs/pbcutil/mshift.cpp index 346f029ead..e95ccff45d 100644 --- a/src/gromacs/pbcutil/mshift.cpp +++ b/src/gromacs/pbcutil/mshift.cpp @@ -175,7 +175,7 @@ void p_graph(FILE *log, const char *title, t_graph *g) g->nedge[i]); for (j = 0; (j < g->nedge[i]); j++) { - fprintf(log, " %5u", g->edge[i][j]+1); + fprintf(log, " %5d", g->edge[i][j]+1); } fprintf(log, "\n"); } diff --git a/src/gromacs/tools/compare.c b/src/gromacs/tools/compare.c index e2ee20b871..89038a4c24 100644 --- a/src/gromacs/tools/compare.c +++ b/src/gromacs/tools/compare.c @@ -86,11 +86,11 @@ static void cmp_us(FILE *fp, const char *s, int index, unsigned short i1, unsign { if (index != -1) { - fprintf(fp, "%s[%d] (%u - %u)\n", s, index, i1, i2); + fprintf(fp, "%s[%d] (%hu - %hu)\n", s, index, i1, i2); } else { - fprintf(fp, "%s (%u - %u)\n", s, i1, i2); + fprintf(fp, "%s (%hu - %hu)\n", s, i1, i2); } } } -- 2.22.0