Skip to content

Commit

Permalink
CI(deps): Update clang-format to v17 (#3860)
Browse files Browse the repository at this point in the history
  • Loading branch information
renovate[bot] authored Jun 25, 2024
1 parent 4b5b6cf commit 4a35e80
Show file tree
Hide file tree
Showing 60 changed files with 135 additions and 131 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/clang-format-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- uses: DoozyX/clang-format-lint-action@11b773b1598aa4ae3b32f023701bca5201c3817d # v0.17
with:
source: "."
clangFormatVersion: 15
clangFormatVersion: 17
inplace: True
- name: Create and uploads code suggestions to apply
id: diff
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ repos:
.*/testsuite/.*
)
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v15.0.7
rev: v17.0.6
hooks:
- id: clang-format
types_or: [c, c++, javascript, json, objective-c]
Expand Down
4 changes: 2 additions & 2 deletions general/g.region/printwindow.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#include <grass/glocale.h>
#include "local_proto.h"

#define DEG2RAD(a) ((a)*M_PI / 180.0)
#define RAD2DEG(a) ((a)*180.0 / M_PI)
#define DEG2RAD(a) ((a) * M_PI / 180.0)
#define RAD2DEG(a) ((a) * 180.0 / M_PI)

static double get_shift(double east)
{
Expand Down
2 changes: 1 addition & 1 deletion imagery/i.eb.netrad/r_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ double r_net(double bbalb, double ndvi UNUSED, double tempk, double dtair,
Kin = 1358.0 * (cos(sunzangle * PI / 180) * tsw / (ds * ds));

/* Lin is incoming longwave radiation */
Lin = (e_atm)*5.67 * pow(10, -8) * pow((tempk - dtair), 4);
Lin = (e_atm) * 5.67 * pow(10, -8) * pow((tempk - dtair), 4);

/* Lout is surface grey body emission in Longwave spectrum */
Lout = e0 * 5.67 * pow(10, -8) * pow(tempk, 4);
Expand Down
2 changes: 1 addition & 1 deletion imagery/i.fft/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ int main(int argc, char *argv[])
cell_real = Rast_allocate_d_buf();
cell_imag = Rast_allocate_d_buf();

#define C(i, j) ((i)*cols + (j))
#define C(i, j) ((i) * cols + (j))

/* Read in cell map values */
G_message(_("Reading the raster map <%s>..."), Cellmap_orig);
Expand Down
2 changes: 1 addition & 1 deletion imagery/i.ifft/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ int main(int argc, char *argv[])
cell_real = Rast_allocate_d_buf();
cell_imag = Rast_allocate_d_buf();

#define C(i, j) ((i)*cols + (j))
#define C(i, j) ((i) * cols + (j))

/* Read in cell map values */
G_message(_("Reading raster maps..."));
Expand Down
30 changes: 15 additions & 15 deletions imagery/i.maxlik/invert.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,35 +124,35 @@ int invert(struct One_Sig *s, int nbands, int *ik, int *jk, double *det)

/* zero means non-invertible */
if (*det == 0.0)
return 0;
return 0;

/*
* if negative, then matrix is not positive-definite
* (But this probably not a sufficient test)
*/
if (*det < 0.0)
return -1;
return -1;

/* restore ordering of matrix */
for (k = nbands - 1; k >= 0; k--) { /* 530 */
j = ik[k];
j = ik[k];

if (j > k)
for (i = 0; i < nbands; i++) { /* 510 */
v = s->var[i][k];
s->var[i][k] = -(s->var[i][j]);
s->var[i][j] = v;
if (j > k)
for (i = 0; i < nbands; i++) { /* 510 */
v = s->var[i][k];
s->var[i][k] = -(s->var[i][j]);
s->var[i][j] = v;
/*510 */ }

i = jk[k];
i = jk[k];

if (i > k)
for (j = 0; j < nbands; j++) { /* 520 */
v = s->var[k][j];
s->var[k][j] = -(s->var[i][j]);
s->var[i][j] = v;
if (i > k)
for (j = 0; j < nbands; j++) { /* 520 */
v = s->var[k][j];
s->var[k][j] = -(s->var[i][j]);
s->var[i][j] = v;
/*520 */ }
/*530 */
/*530 */
}

return 1;
Expand Down
6 changes: 3 additions & 3 deletions imagery/i.segment/flag.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ FLAG
};

#define FLAG_UNSET(flags, row, col) \
(flags)->array[(row)][(col) >> 3] &= ~(1 << ((col)&7))
(flags)->array[(row)][(col) >> 3] &= ~(1 << ((col) & 7))

#define FLAG_SET(flags, row, col) \
(flags)->array[(row)][(col) >> 3] |= (1 << ((col)&7))
(flags)->array[(row)][(col) >> 3] |= (1 << ((col) & 7))

#define FLAG_GET(flags, row, col) \
(flags)->array[(row)][(col) >> 3] & (1 << ((col)&7))
(flags)->array[(row)][(col) >> 3] & (1 << ((col) & 7))

/* flag.c */
FLAG *flag_create(int, int);
Expand Down
2 changes: 1 addition & 1 deletion include/grass/gprojects.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
/* adapted from gdal_version.h */
#ifndef PROJ_COMPUTE_VERSION
#define PROJ_COMPUTE_VERSION(maj, min, rev) \
((maj)*1000000 + (min)*10000 + (rev)*100)
((maj) * 1000000 + (min) * 10000 + (rev) * 100)
#endif

/* just in case PROJ introduces PROJ_VERSION_NUM in a future version */
Expand Down
2 changes: 1 addition & 1 deletion lib/bitmap/bitmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include <grass/bitmap.h>

#define BM_col_to_byte(x) ((x) >> 3) /* x / 8 */
#define BM_col_to_bit(x) ((x)&7) /* x % 8 */
#define BM_col_to_bit(x) ((x) & 7) /* x % 8 */

static int Mode = BM_FLAT;
static int Size = 1;
Expand Down
2 changes: 1 addition & 1 deletion lib/bitmap/sparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <grass/bitmap.h>

#define BM_col_to_byte(x) ((x) >> 3) /* x / 8 */
#define BM_col_to_bit(x) ((x)&7) /* x % 8 */
#define BM_col_to_bit(x) ((x) & 7) /* x % 8 */

static int depth;

Expand Down
10 changes: 5 additions & 5 deletions lib/external/parson/parson.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
#if defined(isnan) && defined(isinf)
#define IS_NUMBER_INVALID(x) (isnan((x)) || isinf((x)))
#else
#define IS_NUMBER_INVALID(x) (((x)*0.0) != 0.0)
#define IS_NUMBER_INVALID(x) (((x) * 0.0) != 0.0)
#endif

#define OBJECT_INVALID_IX ((size_t)-1)
Expand All @@ -109,7 +109,7 @@ static JSON_Number_Serialization_Function parson_number_serialization_function =
NULL;

#define IS_CONT(b) \
(((unsigned char)(b)&0xC0) == 0x80) /* is utf-8 continuation byte */
(((unsigned char)(b) & 0xC0) == 0x80) /* is utf-8 continuation byte */

typedef int parson_bool_t;

Expand Down Expand Up @@ -900,13 +900,13 @@ static JSON_Status parse_utf16(const char **unprocessed, char **processed)
}
else if (cp < 0x800) {
processed_ptr[0] = ((cp >> 6) & 0x1F) | 0xC0; /* 110xxxxx */
processed_ptr[1] = ((cp)&0x3F) | 0x80; /* 10xxxxxx */
processed_ptr[1] = ((cp) & 0x3F) | 0x80; /* 10xxxxxx */
processed_ptr += 1;
}
else if (cp < 0xD800 || cp > 0xDFFF) {
processed_ptr[0] = ((cp >> 12) & 0x0F) | 0xE0; /* 1110xxxx */
processed_ptr[1] = ((cp >> 6) & 0x3F) | 0x80; /* 10xxxxxx */
processed_ptr[2] = ((cp)&0x3F) | 0x80; /* 10xxxxxx */
processed_ptr[2] = ((cp) & 0x3F) | 0x80; /* 10xxxxxx */
processed_ptr += 2;
}
else if (cp >= 0xD800 &&
Expand All @@ -927,7 +927,7 @@ static JSON_Status parse_utf16(const char **unprocessed, char **processed)
processed_ptr[0] = (((cp >> 18) & 0x07) | 0xF0); /* 11110xxx */
processed_ptr[1] = (((cp >> 12) & 0x3F) | 0x80); /* 10xxxxxx */
processed_ptr[2] = (((cp >> 6) & 0x3F) | 0x80); /* 10xxxxxx */
processed_ptr[3] = (((cp)&0x3F) | 0x80); /* 10xxxxxx */
processed_ptr[3] = (((cp) & 0x3F) | 0x80); /* 10xxxxxx */
processed_ptr += 3;
}
else { /* trail surrogate before lead surrogate */
Expand Down
2 changes: 1 addition & 1 deletion lib/gis/lrand48.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ static const uint32 b0 = 0xB;

static int seeded;

#define LO(x) ((x)&0xFFFFU)
#define LO(x) ((x) & 0xFFFFU)
#define HI(x) ((x) >> 16)

/*!
Expand Down
2 changes: 1 addition & 1 deletion lib/gis/lz4.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ typedef size_t uptrval; /* generally true, except OpenVMS-64 */
#if defined(__x86_64__)
typedef U64 reg_t; /* 64-bits in x32 mode */
#else
typedef size_t reg_t; /* 32-bits in x32 mode */
typedef size_t reg_t; /* 32-bits in x32 mode */
#endif

/*-************************************
Expand Down
4 changes: 2 additions & 2 deletions lib/gis/pi.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include <grass/gis.h>

#define Radians(x) ((x)*M_PI / 180.0)
#define Degrees(x) ((x)*180.0 / M_PI)
#define Radians(x) ((x) * M_PI / 180.0)
#define Degrees(x) ((x) * 180.0 / M_PI)

#endif /* __PI_H__ */
2 changes: 1 addition & 1 deletion lib/gis/sleep.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ void G_sleep(unsigned int seconds)
{
#ifdef __MINGW32__
/* note: Sleep() cannot be interrupted */
Sleep((seconds)*1000);
Sleep((seconds) * 1000);
#else
sleep(seconds);
#endif
Expand Down
3 changes: 2 additions & 1 deletion lib/gmath/solvers_direct.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ int G_math_cholesky_decomposition(double **A, int rows, int bandwidth)
colsize = bandwidth;

for (k = 0; k < rows; k++) {
#pragma omp parallel for schedule (static) private(i, j, sum_2) shared(A, k) reduction(+:sum_1)
#pragma omp parallel for schedule(static) private(i, j, sum_2) shared(A, k) \
reduction(+ : sum_1)
for (j = 0; j < k; j++) {
sum_1 += A[k][j] * A[k][j];
}
Expand Down
15 changes: 10 additions & 5 deletions lib/gpde/test/test_arrays.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ int fill_array_2d(N_array_2d *a)
cols = a->cols;
type = N_get_array_2d_type(a);

#pragma omp parallel for private (i, j) shared (cols, rows, type, a) reduction(+:res)
#pragma omp parallel for private(i, j) shared(cols, rows, type, a) \
reduction(+ : res)
for (j = 0; j < rows; j++) {
for (i = 0; i < cols; i++) {
if (type == CELL_TYPE) {
Expand Down Expand Up @@ -129,7 +130,8 @@ int compare_array_2d(N_array_2d *a, N_array_2d *b)
rows = a->rows;
type = N_get_array_2d_type(a);

#pragma omp parallel for private (i, j) shared (cols, rows, type, a, b) reduction(+:res)
#pragma omp parallel for private(i, j) shared(cols, rows, type, a, b) \
reduction(+ : res)
for (j = 0; j < rows; j++) {
for (i = 0; i < cols; i++) {
if (type == CELL_TYPE) {
Expand Down Expand Up @@ -166,7 +168,8 @@ int fill_array_3d(N_array_3d *a)
depths = a->depths;
type = N_get_array_3d_type(a);

#pragma omp parallel for private (i, j, k) shared (depths, rows, cols, type, a) reduction(+:res)
#pragma omp parallel for private(i, j, k) shared(depths, rows, cols, type, a) \
reduction(+ : res)
for (k = 0; k < depths; k++) {
for (j = 0; j < rows; j++) {
for (i = 0; i < cols; i++) {
Expand Down Expand Up @@ -204,7 +207,8 @@ int fill_array_3d_null(N_array_3d *a)
depths = a->depths;
type = N_get_array_3d_type(a);

#pragma omp parallel for private (i, j, k) shared (cols, rows, depths, type, a) reduction(+:res)
#pragma omp parallel for private(i, j, k) shared(cols, rows, depths, type, a) \
reduction(+ : res)
for (k = 0; k < depths; k++) {
for (j = 0; j < rows; j++) {
for (i = 0; i < cols; i++) {
Expand All @@ -231,7 +235,8 @@ int compare_array_3d(N_array_3d *a, N_array_3d *b)
depths = a->depths;
type = N_get_array_3d_type(a);

#pragma omp parallel for private (i, j, k) shared (depths, rows, cols, type, a, b) reduction(+:res)
#pragma omp parallel for private(i, j, k) \
shared(depths, rows, cols, type, a, b) reduction(+ : res)
for (k = 0; k < depths; k++) {
for (i = 0; i < rows; i++) {
for (j = 0; j < cols; j++) {
Expand Down
2 changes: 1 addition & 1 deletion lib/ogsf/gs2.c
Original file line number Diff line number Diff line change
Expand Up @@ -3428,7 +3428,7 @@ void GS_clear(int col)
*/
glClearDepth(1.0);
glClearColor(
((float)((col)&0xff)) / 255., (float)((col) >> 8 & 0xff) / 255.,
((float)((col) & 0xff)) / 255., (float)((col) >> 8 & 0xff) / 255.,
(float)((col) >> 16 & 0xff) / 255., (float)((col) >> 24 & 0xff) / 255.);
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);

Expand Down
8 changes: 4 additions & 4 deletions lib/ogsf/gsget.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@
nv[Z] = (int)((i) & NZMASK) * GS_global_exag()/(float)ZMAXPOS
*/

#define FNORM(i, nv) \
nv[X] = ((int)(((i)&NXMASK) >> 21) - XYMAXPOS) / (float)XYMAXPOS; \
nv[Y] = ((int)(((i)&NYMASK) >> 10) - XYMAXPOS) / (float)XYMAXPOS; \
nv[Z] = (int)((i)&NZMASK) / (float)ZMAXPOS
#define FNORM(i, nv) \
nv[X] = ((int)(((i) & NXMASK) >> 21) - XYMAXPOS) / (float)XYMAXPOS; \
nv[Y] = ((int)(((i) & NYMASK) >> 10) - XYMAXPOS) / (float)XYMAXPOS; \
nv[Z] = (int)((i) & NZMASK) / (float)ZMAXPOS

/* Pack Normal vector into int */
#define PNORM(i, nv) \
Expand Down
4 changes: 2 additions & 2 deletions lib/ogsf/rgbpack.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#define INT_TO_GRN(i, g) (g = (i & GRN_MASK) >> 8)
#define INT_TO_BLU(i, b) (b = (i & BLU_MASK) >> 16)

#define RGB_TO_INT(r, g, b, i) \
(i = (((r)&RED_MASK) + ((int)((g) << 8) & GRN_MASK) + \
#define RGB_TO_INT(r, g, b, i) \
(i = (((r) & RED_MASK) + ((int)((g) << 8) & GRN_MASK) + \
((int)((b) << 16) & BLU_MASK)))

#define CONST_COLS 45
Expand Down
10 changes: 5 additions & 5 deletions lib/ogsf/rowcol.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#define VCOLS(gs) (int)((gs->cols - 1) / gs->x_mod)

/* data row & col to offset */
#define DRC2OFF(gs, drow, dcol) (int)((dcol) + (drow)*gs->cols)
#define DRC2OFF(gs, drow, dcol) (int)((dcol) + (drow) * gs->cols)

/* ycoord/xcoord to data row/col */
#define Y2DROW(gs, py) (int)((gs->yrange - (py)) / gs->yres)
Expand All @@ -32,11 +32,11 @@
#define VCOL2DCOL(gs, vcol) (int)(gs->x_mod * (vcol))

/* data row/col to ycoord/xcoord */
#define DROW2Y(gs, drow) (gs->yrange - ((drow)*gs->yres))
#define DCOL2X(gs, dcol) ((dcol)*gs->xres)
#define DROW2Y(gs, drow) (gs->yrange - ((drow) * gs->yres))
#define DCOL2X(gs, dcol) ((dcol) * gs->xres)

/* viewres row/col to ycoord/xcoord */
#define VROW2Y(gs, vrow) (gs->yrange - ((vrow)*gs->yres * gs->y_mod))
#define VCOL2X(gs, vcol) ((vcol)*gs->xres * gs->x_mod)
#define VROW2Y(gs, vrow) (gs->yrange - ((vrow) * gs->yres * gs->y_mod))
#define VCOL2X(gs, vcol) ((vcol) * gs->xres * gs->x_mod)

#endif /* _ROWCOL_H */
2 changes: 1 addition & 1 deletion lib/raster/get_row.c
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,7 @@ int Rast__read_null_bits(int fd, int row, unsigned char *flags)
}

#define check_null_bit(flags, bit_num) \
((flags)[(bit_num) >> 3] & ((unsigned char)0x80 >> ((bit_num)&7)) ? 1 : 0)
((flags)[(bit_num) >> 3] & ((unsigned char)0x80 >> ((bit_num) & 7)) ? 1 : 0)

static void get_null_value_row_nomask(int fd, char *flags, int row)
{
Expand Down
10 changes: 5 additions & 5 deletions lib/rst/interp_float/segmen2d_parallel.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ int IL_interp_segments_2d_parallel(
cut_tree(tree, all_leafs, &i);

G_message(_("Starting parallel work"));
#pragma omp parallel firstprivate( \
tid, i, j, zmin, zmax, tree, totsegm, offset1, dnorm, smseg, ertot, \
params, info, all_leafs, bitmask, b, indx, matrix, data_local, A) \
shared(cursegm, threads, some_thread_failed, zminac, zmaxac, gmin, gmax, \
c1min, c1max, c2min, c2max) default(none)
#pragma omp parallel firstprivate( \
tid, i, j, zmin, zmax, tree, totsegm, offset1, dnorm, smseg, ertot, \
params, info, all_leafs, bitmask, b, indx, matrix, data_local, A) \
shared(cursegm, threads, some_thread_failed, zminac, zmaxac, gmin, gmax, \
c1min, c1max, c2min, c2max) default(none)
{
#pragma omp for schedule(dynamic)
for (i_cnt = 0; i_cnt < totsegm; i_cnt++) {
Expand Down
2 changes: 1 addition & 1 deletion lib/vector/Vlib/intersect2.c
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ static int cross_seg(int i, int j, int b)
#define QEVT_CRS 3

#define GET_PARENT(p, c) ((p) = (int)(((c)-2) / 3 + 1))
#define GET_CHILD(c, p) ((c) = (int)(((p)*3) - 1))
#define GET_CHILD(c, p) ((c) = (int)(((p) * 3) - 1))

struct qitem {
int l; /* line 0 - A line , 1 - B line */
Expand Down
2 changes: 1 addition & 1 deletion lib/vector/dglib/graph_v1.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
#define DGL_EDGESET_EDGECOUNT_v1(p) ((p)[DGL_ILA_TOCNT_v1])
#define DGL_EDGESET_EDGEARRAY_PTR_v1(p) ((p) + DGL_ILA_TOARR_v1)
#define DGL_EDGESET_EDGE_PTR_v1(p, i, C) \
(((p) + DGL_ILA_TOARR_v1) + (i)*DGL_EDGE_WSIZE_v1(C))
(((p) + DGL_ILA_TOARR_v1) + (i) * DGL_EDGE_WSIZE_v1(C))

/*
* Edge macros - addresses in a flat edge
Expand Down
Loading

0 comments on commit 4a35e80

Please sign in to comment.