diff --git a/src/COMPRESS/dump_atom_gz.cpp b/src/COMPRESS/dump_atom_gz.cpp index d4fb01a3e6..e6d8d9534b 100644 --- a/src/COMPRESS/dump_atom_gz.cpp +++ b/src/COMPRESS/dump_atom_gz.cpp @@ -106,7 +106,7 @@ void DumpAtomGZ::write_header(bigint ndump) } header += fmt::format("ITEM: ATOMS {}\n", columns); - writer.write(header.c_str(), header.length()); + (void) writer.write(header.c_str(), header.length()); } } @@ -115,7 +115,7 @@ void DumpAtomGZ::write_header(bigint ndump) void DumpAtomGZ::write_data(int n, double *mybuf) { if (buffer_flag == 1) { - writer.write(mybuf, n); + (void) writer.write(mybuf, n); } else { constexpr size_t VBUFFER_SIZE = 256; char vbuffer[VBUFFER_SIZE]; @@ -133,7 +133,7 @@ void DumpAtomGZ::write_data(int n, double *mybuf) static_cast(mybuf[m + 1]), mybuf[m + 2], mybuf[m + 3], mybuf[m + 4]); } if (written > 0) { - writer.write(vbuffer, written); + (void) writer.write(vbuffer, written); } else if (written < 0) { error->one(FLERR, "Error while writing dump atom/gz output"); } diff --git a/src/COMPRESS/dump_atom_zstd.cpp b/src/COMPRESS/dump_atom_zstd.cpp index a1a098eb19..55800a82b6 100644 --- a/src/COMPRESS/dump_atom_zstd.cpp +++ b/src/COMPRESS/dump_atom_zstd.cpp @@ -112,7 +112,7 @@ void DumpAtomZstd::write_header(bigint ndump) } header += fmt::format("ITEM: ATOMS {}\n", columns); - writer.write(header.c_str(), header.length()); + (void) writer.write(header.c_str(), header.length()); } } @@ -121,7 +121,7 @@ void DumpAtomZstd::write_header(bigint ndump) void DumpAtomZstd::write_data(int n, double *mybuf) { if (buffer_flag == 1) { - writer.write(mybuf, n); + (void) writer.write(mybuf, n); } else { constexpr size_t VBUFFER_SIZE = 256; char vbuffer[VBUFFER_SIZE]; @@ -139,7 +139,7 @@ void DumpAtomZstd::write_data(int n, double *mybuf) static_cast(mybuf[m + 1]), mybuf[m + 2], mybuf[m + 3], mybuf[m + 4]); } if (written > 0) { - writer.write(vbuffer, written); + (void) writer.write(vbuffer, written); } else if (written < 0) { error->one(FLERR, "Error while writing dump atom/gz output"); } diff --git a/src/COMPRESS/dump_cfg_gz.cpp b/src/COMPRESS/dump_cfg_gz.cpp index e4d5ae76cc..04b75a98b7 100644 --- a/src/COMPRESS/dump_cfg_gz.cpp +++ b/src/COMPRESS/dump_cfg_gz.cpp @@ -111,7 +111,7 @@ void DumpCFGGZ::write_header(bigint n) header += fmt::format("entry_count = {}\n", nfield - 2); for (int i = 0; i < nfield - 5; i++) header += fmt::format("auxiliary[{}] = {}\n", i, auxname[i]); - writer.write(header.c_str(), header.length()); + (void) writer.write(header.c_str(), header.length()); } /* ---------------------------------------------------------------------- */ @@ -119,7 +119,7 @@ void DumpCFGGZ::write_header(bigint n) void DumpCFGGZ::write_data(int n, double *mybuf) { if (buffer_flag) { - writer.write(mybuf, n); + (void) writer.write(mybuf, n); } else { constexpr size_t VBUFFER_SIZE = 256; char vbuffer[VBUFFER_SIZE]; @@ -143,13 +143,13 @@ void DumpCFGGZ::write_data(int n, double *mybuf) written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast(mybuf[m])); } if (written > 0) { - writer.write(vbuffer, written); + (void) writer.write(vbuffer, written); } else if (written < 0) { error->one(FLERR, "Error while writing dump cfg/gz output"); } m++; } - writer.write("\n", 1); + (void) writer.write("\n", 1); } } else if (unwrapflag == 1) { int m = 0; @@ -174,13 +174,13 @@ void DumpCFGGZ::write_data(int n, double *mybuf) written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast(mybuf[m])); } if (written > 0) { - writer.write(vbuffer, written); + (void) writer.write(vbuffer, written); } else if (written < 0) { error->one(FLERR, "Error while writing dump cfg/gz output"); } m++; } - writer.write("\n", 1); + (void) writer.write("\n", 1); } } } diff --git a/src/COMPRESS/dump_cfg_zstd.cpp b/src/COMPRESS/dump_cfg_zstd.cpp index c52f9e0942..62d6c6bf4b 100644 --- a/src/COMPRESS/dump_cfg_zstd.cpp +++ b/src/COMPRESS/dump_cfg_zstd.cpp @@ -119,7 +119,7 @@ void DumpCFGZstd::write_header(bigint n) header += fmt::format("entry_count = {}\n", nfield - 2); for (int i = 0; i < nfield - 5; i++) header += fmt::format("auxiliary[{}] = {}\n", i, auxname[i]); - writer.write(header.c_str(), header.length()); + (void) writer.write(header.c_str(), header.length()); } /* ---------------------------------------------------------------------- */ @@ -127,7 +127,7 @@ void DumpCFGZstd::write_header(bigint n) void DumpCFGZstd::write_data(int n, double *mybuf) { if (buffer_flag) { - writer.write(mybuf, n); + (void) writer.write(mybuf, n); } else { constexpr size_t VBUFFER_SIZE = 256; char vbuffer[VBUFFER_SIZE]; @@ -151,13 +151,13 @@ void DumpCFGZstd::write_data(int n, double *mybuf) written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast(mybuf[m])); } if (written > 0) { - writer.write(vbuffer, written); + (void) writer.write(vbuffer, written); } else if (written < 0) { error->one(FLERR, "Error while writing dump cfg/gz output"); } m++; } - writer.write("\n", 1); + (void) writer.write("\n", 1); } } else if (unwrapflag == 1) { int m = 0; @@ -182,13 +182,13 @@ void DumpCFGZstd::write_data(int n, double *mybuf) written = snprintf(vbuffer, VBUFFER_SIZE, vformat[j], static_cast(mybuf[m])); } if (written > 0) { - writer.write(vbuffer, written); + (void) writer.write(vbuffer, written); } else if (written < 0) { error->one(FLERR, "Error while writing dump cfg/gz output"); } m++; } - writer.write("\n", 1); + (void) writer.write("\n", 1); } } } diff --git a/src/COMPRESS/dump_custom_gz.cpp b/src/COMPRESS/dump_custom_gz.cpp index 3ff0124b24..35515d3f47 100644 --- a/src/COMPRESS/dump_custom_gz.cpp +++ b/src/COMPRESS/dump_custom_gz.cpp @@ -104,7 +104,7 @@ void DumpCustomGZ::write_header(bigint ndump) } header += fmt::format("ITEM: ATOMS {}\n", columns); - writer.write(header.c_str(), header.length()); + (void) writer.write(header.c_str(), header.length()); } } @@ -113,7 +113,7 @@ void DumpCustomGZ::write_header(bigint ndump) void DumpCustomGZ::write_data(int n, double *mybuf) { if (buffer_flag == 1) { - writer.write(mybuf, n); + (void) writer.write(mybuf, n); } else { constexpr size_t VBUFFER_SIZE = 256; char vbuffer[VBUFFER_SIZE]; @@ -132,13 +132,13 @@ void DumpCustomGZ::write_data(int n, double *mybuf) } if (written > 0) { - writer.write(vbuffer, written); + (void) writer.write(vbuffer, written); } else if (written < 0) { error->one(FLERR, "Error while writing dump custom/gz output"); } m++; } - writer.write("\n", 1); + (void) writer.write("\n", 1); } } } diff --git a/src/COMPRESS/dump_custom_zstd.cpp b/src/COMPRESS/dump_custom_zstd.cpp index 10d6d3e440..a2c4ae448c 100644 --- a/src/COMPRESS/dump_custom_zstd.cpp +++ b/src/COMPRESS/dump_custom_zstd.cpp @@ -122,7 +122,7 @@ void DumpCustomZstd::write_header(bigint ndump) } header += fmt::format("ITEM: ATOMS {}\n", columns); - writer.write(header.c_str(), header.length()); + (void) writer.write(header.c_str(), header.length()); } } @@ -131,7 +131,7 @@ void DumpCustomZstd::write_header(bigint ndump) void DumpCustomZstd::write_data(int n, double *mybuf) { if (buffer_flag == 1) { - writer.write(mybuf, n); + (void) writer.write(mybuf, n); } else { constexpr size_t VBUFFER_SIZE = 256; char vbuffer[VBUFFER_SIZE]; @@ -150,13 +150,13 @@ void DumpCustomZstd::write_data(int n, double *mybuf) } if (written > 0) { - writer.write(vbuffer, written); + (void) writer.write(vbuffer, written); } else if (written < 0) { error->one(FLERR, "Error while writing dump custom/gz output"); } m++; } - writer.write("\n", 1); + (void) writer.write("\n", 1); } } } diff --git a/src/COMPRESS/dump_local_gz.cpp b/src/COMPRESS/dump_local_gz.cpp index b39f6bc7ac..0a00c750fa 100644 --- a/src/COMPRESS/dump_local_gz.cpp +++ b/src/COMPRESS/dump_local_gz.cpp @@ -104,7 +104,7 @@ void DumpLocalGZ::write_header(bigint ndump) } header += fmt::format("ITEM: {} {}\n", label, columns); - writer.write(header.c_str(), header.length()); + (void) writer.write(header.c_str(), header.length()); } } @@ -113,7 +113,7 @@ void DumpLocalGZ::write_header(bigint ndump) void DumpLocalGZ::write_data(int n, double *mybuf) { if (buffer_flag == 1) { - writer.write(mybuf, sizeof(char) * n); + (void) writer.write(mybuf, sizeof(char) * n); } else { constexpr size_t VBUFFER_SIZE = 256; char vbuffer[VBUFFER_SIZE]; @@ -132,13 +132,13 @@ void DumpLocalGZ::write_data(int n, double *mybuf) } if (written > 0) { - writer.write(vbuffer, written); + (void) writer.write(vbuffer, written); } else if (written < 0) { error->one(FLERR, "Error while writing dump local/gz output"); } m++; } - writer.write("\n", 1); + (void) writer.write("\n", 1); } } } diff --git a/src/COMPRESS/dump_local_zstd.cpp b/src/COMPRESS/dump_local_zstd.cpp index cb805750e1..66e9df03f8 100644 --- a/src/COMPRESS/dump_local_zstd.cpp +++ b/src/COMPRESS/dump_local_zstd.cpp @@ -112,7 +112,7 @@ void DumpLocalZstd::write_header(bigint ndump) } header += fmt::format("ITEM: {} {}\n", label, columns); - writer.write(header.c_str(), header.length()); + (void) writer.write(header.c_str(), header.length()); } } @@ -121,7 +121,7 @@ void DumpLocalZstd::write_header(bigint ndump) void DumpLocalZstd::write_data(int n, double *mybuf) { if (buffer_flag == 1) { - writer.write(mybuf, sizeof(char) * n); + (void) writer.write(mybuf, sizeof(char) * n); } else { constexpr size_t VBUFFER_SIZE = 256; char vbuffer[VBUFFER_SIZE]; @@ -140,13 +140,13 @@ void DumpLocalZstd::write_data(int n, double *mybuf) } if (written > 0) { - writer.write(vbuffer, written); + (void) writer.write(vbuffer, written); } else if (written < 0) { error->one(FLERR, "Error while writing dump local/gz output"); } m++; } - writer.write("\n", 1); + (void) writer.write("\n", 1); } } } diff --git a/src/COMPRESS/dump_xyz_gz.cpp b/src/COMPRESS/dump_xyz_gz.cpp index f4d4361de4..9d70e39409 100644 --- a/src/COMPRESS/dump_xyz_gz.cpp +++ b/src/COMPRESS/dump_xyz_gz.cpp @@ -84,7 +84,7 @@ void DumpXYZGZ::write_header(bigint ndump) auto header = fmt::format("{}\n Atoms. Timestep: {}", ndump, update->ntimestep); if (time_flag) header += fmt::format(" Time: {:.6f}", compute_time()); header += "\n"; - writer.write(header.c_str(), header.length()); + (void) writer.write(header.c_str(), header.length()); } } @@ -93,7 +93,7 @@ void DumpXYZGZ::write_header(bigint ndump) void DumpXYZGZ::write_data(int n, double *mybuf) { if (buffer_flag) { - writer.write(mybuf, n); + (void) writer.write(mybuf, n); } else { constexpr size_t VBUFFER_SIZE = 256; char vbuffer[VBUFFER_SIZE]; @@ -103,7 +103,7 @@ void DumpXYZGZ::write_data(int n, double *mybuf) snprintf(vbuffer, VBUFFER_SIZE, format, typenames[static_cast(mybuf[m + 1])], mybuf[m + 2], mybuf[m + 3], mybuf[m + 4]); if (written > 0) { - writer.write(vbuffer, written); + (void) writer.write(vbuffer, written); } else if (written < 0) { error->one(FLERR, "Error while writing dump xyz/gz output"); } diff --git a/src/COMPRESS/dump_xyz_zstd.cpp b/src/COMPRESS/dump_xyz_zstd.cpp index 976979675a..b51b292839 100644 --- a/src/COMPRESS/dump_xyz_zstd.cpp +++ b/src/COMPRESS/dump_xyz_zstd.cpp @@ -92,7 +92,7 @@ void DumpXYZZstd::write_header(bigint ndump) auto header = fmt::format("{}\n Atoms. Timestep: {}", ndump, update->ntimestep); if (time_flag) header += fmt::format(" Time: {:.6f}", compute_time()); header += "\n"; - writer.write(header.c_str(), header.length()); + (void) writer.write(header.c_str(), header.length()); } } @@ -101,7 +101,7 @@ void DumpXYZZstd::write_header(bigint ndump) void DumpXYZZstd::write_data(int n, double *mybuf) { if (buffer_flag) { - writer.write(mybuf, n); + (void) writer.write(mybuf, n); } else { constexpr size_t VBUFFER_SIZE = 256; char vbuffer[VBUFFER_SIZE]; @@ -111,7 +111,7 @@ void DumpXYZZstd::write_data(int n, double *mybuf) snprintf(vbuffer, VBUFFER_SIZE, format, typenames[static_cast(mybuf[m + 1])], mybuf[m + 2], mybuf[m + 3], mybuf[m + 4]); if (written > 0) { - writer.write(vbuffer, written); + (void) writer.write(vbuffer, written); } else if (written < 0) { error->one(FLERR, "Error while writing dump xyz/gz output"); } diff --git a/src/EXTRA-DUMP/dump_dcd.cpp b/src/EXTRA-DUMP/dump_dcd.cpp index f7e7ab2737..56261338b5 100644 --- a/src/EXTRA-DUMP/dump_dcd.cpp +++ b/src/EXTRA-DUMP/dump_dcd.cpp @@ -300,12 +300,12 @@ void DumpDCD::write_frame() nframes++; out_integer = nframes; - fseek(fp,NFILE_POS,SEEK_SET); + (void) fseek(fp,NFILE_POS,SEEK_SET); fwrite_int32(fp,out_integer); out_integer = update->ntimestep; - fseek(fp,NSTEP_POS,SEEK_SET); + (void) fseek(fp,NSTEP_POS,SEEK_SET); fwrite_int32(fp,out_integer); - fseek(fp,0,SEEK_END); + (void) fseek(fp,0,SEEK_END); } /* ---------------------------------------------------------------------- */ diff --git a/src/EXTRA-FIX/fix_ave_correlate_long.cpp b/src/EXTRA-FIX/fix_ave_correlate_long.cpp index 7c80365c57..738ae3ae4c 100644 --- a/src/EXTRA-FIX/fix_ave_correlate_long.cpp +++ b/src/EXTRA-FIX/fix_ave_correlate_long.cpp @@ -488,7 +488,7 @@ void FixAveCorrelateLong::end_of_step() if (fp && comm->me == 0) { clearerr(fp); - if (overwrite) platform::fseek(fp,filepos); + if (overwrite) (void) platform::fseek(fp,filepos); fmt::print(fp,"# Timestep: {}\n", ntimestep); for (unsigned int i=0; i < npcorr; ++i) { fprintf(fp, "%lg ", t[i]*update->dt*nevery); diff --git a/src/dump.cpp b/src/dump.cpp index c735a4a60d..8cc8d1c7db 100644 --- a/src/dump.cpp +++ b/src/dump.cpp @@ -573,7 +573,7 @@ void Dump::openfile() nameslist[numfiles] = utils::strdup(filecurrent); ++numfiles; } else { - remove(nameslist[fileidx]); + (void) remove(nameslist[fileidx]); delete[] nameslist[fileidx]; nameslist[fileidx] = utils::strdup(filecurrent); fileidx = (fileidx + 1) % maxfiles; diff --git a/src/fix_ave_chunk.cpp b/src/fix_ave_chunk.cpp index 9382b6d38e..d9723cec9f 100644 --- a/src/fix_ave_chunk.cpp +++ b/src/fix_ave_chunk.cpp @@ -899,7 +899,7 @@ void FixAveChunk::end_of_step() if (fp && comm->me == 0) { clearerr(fp); - if (overwrite) platform::fseek(fp,filepos); + if (overwrite) (void) platform::fseek(fp,filepos); double count = 0.0; for (m = 0; m < nchunk; m++) count += count_total[m]; fmt::print(fp,"{} {} {}\n",ntimestep,nchunk,count); diff --git a/src/fix_ave_histo.cpp b/src/fix_ave_histo.cpp index 9b384e60fa..35fd3fc4f9 100644 --- a/src/fix_ave_histo.cpp +++ b/src/fix_ave_histo.cpp @@ -716,7 +716,7 @@ void FixAveHisto::end_of_step() if (fp && comm->me == 0) { clearerr(fp); - if (overwrite) platform::fseek(fp,filepos); + if (overwrite) (void) platform::fseek(fp,filepos); fmt::print(fp,"{} {} {} {} {} {}\n",ntimestep,nbins, stats_total[0],stats_total[1],stats_total[2],stats_total[3]); if (stats_total[0] != 0.0) diff --git a/src/fix_ave_histo_weight.cpp b/src/fix_ave_histo_weight.cpp index cccfc86d59..c6f9b6ad22 100644 --- a/src/fix_ave_histo_weight.cpp +++ b/src/fix_ave_histo_weight.cpp @@ -453,7 +453,7 @@ void FixAveHistoWeight::end_of_step() if (fp && comm->me == 0) { clearerr(fp); - if (overwrite) platform::fseek(fp,filepos); + if (overwrite) (void) platform::fseek(fp,filepos); fmt::print(fp,"{} {} {} {} {} {}\n",ntimestep,nbins, stats_total[0],stats_total[1],stats_total[2],stats_total[3]); if (stats_total[0] != 0.0) diff --git a/src/fix_ave_time.cpp b/src/fix_ave_time.cpp index 417e0fd97a..72ff8ab6c1 100644 --- a/src/fix_ave_time.cpp +++ b/src/fix_ave_time.cpp @@ -640,7 +640,7 @@ void FixAveTime::invoke_scalar(bigint ntimestep) if (fp && comm->me == 0) { clearerr(fp); - if (overwrite) platform::fseek(fp,filepos); + if (overwrite) (void) platform::fseek(fp,filepos); if (yaml_flag) { if (!yaml_header || overwrite) { yaml_header = true; diff --git a/src/min.cpp b/src/min.cpp index e64ff9cb29..931031e44a 100644 --- a/src/min.cpp +++ b/src/min.cpp @@ -785,7 +785,7 @@ void Min::ev_set(bigint ntimestep) int flag; int eflag_global = 1; - for (auto &icompute : elist_global) icompute->matchstep(ntimestep); + for (auto &icompute : elist_global) (void) icompute->matchstep(ntimestep); flag = 0; int eflag_atom = 0; diff --git a/src/platform.cpp b/src/platform.cpp index 7cc4815f51..efed301db7 100644 --- a/src/platform.cpp +++ b/src/platform.cpp @@ -942,7 +942,7 @@ int platform::ftruncate(FILE *fp, bigint length) return 1; } #else - platform::fseek(fp, length); + (void) platform::fseek(fp, length); return ::ftruncate(fileno(fp), (off_t) length); #endif } diff --git a/src/read_restart.cpp b/src/read_restart.cpp index ef30bc81d7..615dd4b4b0 100644 --- a/src/read_restart.cpp +++ b/src/read_restart.cpp @@ -1030,11 +1030,11 @@ void ReadRestart::check_eof_magic() if (me == 0) { bigint curpos = platform::ftell(fp); - platform::fseek(fp,platform::END_OF_FILE); + (void) platform::fseek(fp,platform::END_OF_FILE); bigint offset = platform::ftell(fp) - n; - platform::fseek(fp,offset); + (void) platform::fseek(fp,offset); utils::sfread(FLERR,str,sizeof(char),n,fp,nullptr,error); - platform::fseek(fp,curpos); + (void) platform::fseek(fp,curpos); } MPI_Bcast(str,n,MPI_CHAR,0,world); diff --git a/src/reader_native.cpp b/src/reader_native.cpp index f252e01644..f0a4976038 100644 --- a/src/reader_native.cpp +++ b/src/reader_native.cpp @@ -542,7 +542,7 @@ void ReaderNative::skip_buf(size_t size) { bigint pos = platform::ftell(fp); pos += size; - platform::fseek(fp,pos); + (void) platform::fseek(fp,pos); } bool ReaderNative::is_known_magic_str() const diff --git a/src/variable.cpp b/src/variable.cpp index 12ae516983..b2f6c2882c 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -817,7 +817,7 @@ int Variable::next(int narg, char **arg) fprintf(fp,"%d\n",nextindex+1); fclose(fp); fp = nullptr; - rename("tmp.lammps.variable.lock","tmp.lammps.variable"); + (void) rename("tmp.lammps.variable.lock","tmp.lammps.variable"); if (universe->uscreen) fprintf(universe->uscreen, "Increment via next: value %d on partition %d\n", nextindex+1,universe->iworld);