Commit 088c695a authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Update the clang-formatting tool version to 10.0

parent 62912f13
......@@ -3,4 +3,17 @@ Language: Cpp
BasedOnStyle: Google
KeepEmptyLinesAtTheStartOfBlocks: true
PenaltyBreakAssignment: 2
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 3
SortPriority: 3
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 4
- Regex: '<[[:alnum:].]+>'
Priority: 5
- Regex: '.*'
Priority: 2
SortPriority: 0
- Regex: config.h
Priority: 1
...
The SWIFT source code is using a variation of the 'Google' formatting style.
The script 'format.sh' in the root directory applies the clang-format-5.0
The script 'format.sh' in the root directory applies the clang-format-10
tool with our style choices to all the SWIFT C source file. Please apply
the formatting script to the files before submitting a merge request.
......
......@@ -189,6 +189,6 @@ before you can build it.
==================
The SWIFT source code uses a variation of 'Google' style. The script
'format.sh' in the root directory applies the clang-format-5.0 tool with our
'format.sh' in the root directory applies the clang-format-10 tool with our
style choices to all the SWIFT C source file. Please apply the formatting
script to the files before submitting a merge request.
......@@ -68,7 +68,7 @@ Contribution Guidelines
-----------------------
The SWIFT source code uses a variation of the 'Google' formatting style.
The script 'format.sh' in the root directory applies the clang-format-5.0
The script 'format.sh' in the root directory applies the clang-format-10
tool with our style choices to all the SWIFT C source file. Please apply
the formatting script to the files before submitting a pull request.
......
......@@ -5,10 +5,10 @@
* Use of this source code is governed by a MIT-style license that can be found
* in the LICENSE file.
*/
#include "../config.h"
#include "argparse.h"
#include "config.h"
#include <assert.h>
#include <errno.h>
#include <stdio.h>
......
#include "argparse.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "argparse.h"
static const char *const usages[] = {
"test_argparse [options] [[--] args]",
......
......@@ -1402,7 +1402,7 @@ int main(int argc, char *argv[]) {
parser_write_params_to_file(params, "unused_parameters.yml", /*used=*/0);
}
/* Dump memory use report if collected for the 0 step. */
/* Dump memory use report if collected for the 0 step. */
#ifdef SWIFT_MEMUSE_REPORTS
{
char dumpfile[40];
......@@ -1415,7 +1415,7 @@ int main(int argc, char *argv[]) {
}
#endif
/* Dump MPI requests if collected. */
/* Dump MPI requests if collected. */
#if defined(SWIFT_MPIUSE_REPORTS) && defined(WITH_MPI)
{
char dumpfile[40];
......@@ -1479,7 +1479,7 @@ int main(int argc, char *argv[]) {
}
#endif
/* Dump memory use report if collected. */
/* Dump memory use report if collected. */
#ifdef SWIFT_MEMUSE_REPORTS
{
char dumpfile[40];
......@@ -1493,7 +1493,7 @@ int main(int argc, char *argv[]) {
}
#endif
/* Dump MPI requests if collected. */
/* Dump MPI requests if collected. */
#if defined(SWIFT_MPIUSE_REPORTS) && defined(WITH_MPI)
{
char dumpfile[40];
......@@ -1595,7 +1595,7 @@ int main(int argc, char *argv[]) {
#endif
}
/* Write final stf? */
/* Write final stf? */
#ifdef HAVE_VELOCIRAPTOR
if (with_structure_finding && e.output_list_stf) {
if (e.output_list_stf->final_step_dump && !e.stf_this_timestep)
......
#!/bin/bash
# Clang format command, can be overridden using CLANG_FORMAT_CMD.
# We currrently use version 5.0 so any overrides should provide that.
clang=${CLANG_FORMAT_CMD:="clang-format-5.0"}
# We currrently use version 10.0 so any overrides should provide that.
clang=${CLANG_FORMAT_CMD:="clang-format-10"}
# Formatting command
cmd="$clang -style=file $(git ls-files | grep '\.[ch]$')"
# Test if `clang-format-5.0` works
# Test if `clang-format-10` works
command -v $clang > /dev/null
if [[ $? -ne 0 ]]
then
......
......@@ -16,15 +16,16 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#include "logger_loader_io.h"
#include "logger_header.h"
#include "logger_tools.h"
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <unistd.h>
#include "logger_header.h"
#include "logger_loader_io.h"
#include "logger_tools.h"
/**
* @brief get the size of a file.
*
......
......@@ -17,6 +17,7 @@
*
******************************************************************************/
#include "logger_logfile.h"
#include "logger_loader_io.h"
#include "logger_reader.h"
......
......@@ -17,6 +17,7 @@
*
******************************************************************************/
#include "logger_particle.h"
#include "logger_header.h"
#include "logger_loader_io.h"
#include "logger_reader.h"
......
......@@ -17,6 +17,7 @@
*
******************************************************************************/
#include "logger_time.h"
#include "logger_loader_io.h"
#include "logger_logfile.h"
#include "logger_reader.h"
......
......@@ -17,11 +17,11 @@
*
******************************************************************************/
#include "logger_tools.h"
#include "logger_header.h"
#include "logger_loader_io.h"
#include "logger_reader.h"
#include "logger_particle.h"
#include "logger_reader.h"
#include <stdio.h>
......
......@@ -17,9 +17,10 @@
*
******************************************************************************/
#include "logger_time.h"
#include <stdlib.h>
#include <time.h>
#include "logger_time.h"
#define NUMBER_OF_ELEMENT 10000
#define TIME_BASE 0.04
......
......@@ -20,7 +20,6 @@
#define SWIFT_DEFAULT_BLACK_HOLE_PART_H
#include "chemistry_struct.h"
#include "timeline.h"
/**
......
......@@ -26,7 +26,6 @@
/* Config parameters. */
#include "../config.h"
#include "inline.h"
/* Import the right black holes definition */
......
......@@ -5854,8 +5854,8 @@ struct spart *cell_add_spart(struct engine *e, struct cell *const c) {
}
}
/* Check that the cell was indeed drifted to this point to avoid future
* issues */
/* Check that the cell was indeed drifted to this point to avoid future
* issues */
#ifdef SWIFT_DEBUG_CHECKS
if (top->hydro.super != NULL && top->stars.count > 0 &&
top->stars.ti_old_part != e->ti_current) {
......@@ -5989,8 +5989,8 @@ struct gpart *cell_add_gpart(struct engine *e, struct cell *c) {
}
}
/* Check that the cell was indeed drifted to this point to avoid future
* issues */
/* Check that the cell was indeed drifted to this point to avoid future
* issues */
#ifdef SWIFT_DEBUG_CHECKS
if (top->grav.super != NULL && top->grav.count > 0 &&
top->grav.ti_old_part != e->ti_current) {
......
......@@ -165,7 +165,7 @@ void io_read_attribute_graceful(hid_t grp, const char* name,
const htri_t h_exists = H5Aexists(grp, name);
if (h_exists <= 0) {
/* Attribute either does not exist (0) or function failed (-ve) */
/* Attribute either does not exist (0) or function failed (-ve) */
#ifdef SWIFT_DEBUG_CHECKS
message("WARNING: attribute '%s' does not exist.", name);
#endif
......@@ -176,7 +176,7 @@ void io_read_attribute_graceful(hid_t grp, const char* name,
if (h_attr >= 0) {
const hid_t h_err = H5Aread(h_attr, io_hdf5_type(type), data);
if (h_err < 0) {
/* Explicitly do nothing unless debugging checks are activated */
/* Explicitly do nothing unless debugging checks are activated */
#ifdef SWIFT_DEBUG_CHECKS
message("WARNING: unable to read attribute '%s'", name);
#endif
......
......@@ -293,7 +293,7 @@ void read_cooling_header(const char *fname,
cooling->nH[i] = log10(cooling->nH[i]);
}
/* Compute inverse of solar mass fractions */
/* Compute inverse of solar mass fractions */
#if defined(__ICC)
#pragma novector
#endif
......
......@@ -26,7 +26,6 @@
/* Config parameters. */
#include "../config.h"
#include "cooling_struct.h"
/*! Number of different bins along the redhsift axis of the tables */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment