Skip to content

Commit

Permalink
CI(deps): Update pre-commit hook pre-commit/mirrors-clang-format to v…
Browse files Browse the repository at this point in the history
…18 (#4183)

* CI(deps): Update pre-commit hook pre-commit/mirrors-clang-format to v18

* Update clang-format-check.yml to use version 18.1.8

* Format files with clang-format 18.1.8

* Fix missing whitespace around operator (flake8)

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Edouard Choinière <[email protected]>
  • Loading branch information
renovate[bot] and echoix authored Aug 15, 2024
1 parent 46903c0 commit 0d5d274
Show file tree
Hide file tree
Showing 91 changed files with 187 additions and 196 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/clang-format-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
persist-credentials: false
- uses: DoozyX/clang-format-lint-action@11b773b1598aa4ae3b32f023701bca5201c3817d # v0.17
- uses: DoozyX/clang-format-lint-action@caa179272c6ee7f1d25dfb503ee0c410c26ebd98 # v0.18.1
with:
source: "."
clangFormatVersion: 17
clangFormatVersion: 18.1.8
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 @@ -66,7 +66,7 @@ repos:
.*/testsuite/.*
)
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v17.0.6
rev: v18.1.8
hooks:
- id: clang-format
types_or: [c, c++, javascript, json, objective-c]
Expand Down
2 changes: 1 addition & 1 deletion display/d.colortable/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ int main(int argc, char **argv)
if (atcat > (int)dmax)
break;
} /* col loop */
} /* int map */
} /* int map */

else {

Expand Down
2 changes: 1 addition & 1 deletion display/d.histogram/bar.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ int bar(struct stat_list *dist_stats, /* list of distribution statistics */
y_box[1] = y_box[2] = bar_height;
D_polygon_abs(x_box, y_box, 4);
}
} /* fp */
} /* fp */
else { /* 1-color bar for int data or null */

D_color((CELL)bar_color, colors);
Expand Down
2 changes: 1 addition & 1 deletion imagery/i.ortho.photo/i.ortho.rectify/defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#define L2BSIZE (2 * (L2BDIM))
#define BSIZE (1 << (L2BSIZE))
#define HI(i) ((i) >> (L2BDIM))
#define LO(i) ((i) & ((BDIM)-1))
#define LO(i) ((i) & ((BDIM) - 1))

typedef DCELL block[BDIM][BDIM]; /* FCELL sufficient ? */

Expand Down
2 changes: 1 addition & 1 deletion imagery/i.rectify/defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#define L2BSIZE (2 * (L2BDIM))
#define BSIZE (1 << (L2BSIZE))
#define HI(i) ((i) >> (L2BDIM))
#define LO(i) ((i) & ((BDIM)-1))
#define LO(i) ((i) & ((BDIM) - 1))

typedef DCELL block[BDIM][BDIM]; /* FCELL sufficient ? */

Expand Down
4 changes: 2 additions & 2 deletions imagery/i.segment/mean_shift.c
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ static int find_best_neighbour(struct globals *globals, int row, int col,
}
}
}
} while (n--); /* end do loop - next neighbor */
} while (n--); /* end do loop - next neighbor */
} while (rclist_drop(&rilist, &next)); /* while there are cells to check */

rclist_destroy(&rilist);
Expand Down Expand Up @@ -671,7 +671,7 @@ static int update_rid(struct globals *globals, int row, int col, int new_id)
Segment_put(&globals->rid_seg, (void *)&new_id, rown, coln);
}
}
} while (n--); /* end do loop - next neighbor */
} while (n--); /* end do loop - next neighbor */
} while (rclist_drop(&rilist, &next)); /* while there are cells to check */

rclist_destroy(&rilist);
Expand Down
8 changes: 4 additions & 4 deletions imagery/i.segment/region_growing.c
Original file line number Diff line number Diff line change
Expand Up @@ -520,9 +520,9 @@ int region_growing(struct globals *globals)
}
}
} /* end if < threshold */
} /* end pathflag */
} /* next col */
} /* next row */
} /* end pathflag */
} /* next col */
} /* next row */
G_percent(1, 1, 1);

/* finished one pass for processing candidate pixels */
Expand Down Expand Up @@ -844,7 +844,7 @@ static int find_best_neighbor(struct ngbr_stats *Ri, struct reg_stats *Ri_rs,
}
}
}
} while (n--); /* end do loop - next neighbor */
} while (n--); /* end do loop - next neighbor */
} while (rclist_drop(&rilist, &next)); /* while there are cells to check */

/* clean up */
Expand Down
2 changes: 1 addition & 1 deletion include/grass/iostream/embuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ void em_buffer<T, Key>::cleanup()
}
j++;
} // if data[i] != NULL
} // for i
} // for i

// set the index
assert(index == j + empty);
Expand Down
2 changes: 1 addition & 1 deletion include/grass/iostream/empq_adaptive.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class EMPQueueAdaptive {
public:
/* start in INMEM regim by allocating im of size precisely twice the
size of the (pqueue within) the em_pqueue; */
EMPQueueAdaptive(long N UNUSED) : EMPQueueAdaptive(){};
EMPQueueAdaptive(long N UNUSED) : EMPQueueAdaptive() {};
EMPQueueAdaptive();
EMPQueueAdaptive(size_t inMem);
~EMPQueueAdaptive();
Expand Down
10 changes: 5 additions & 5 deletions include/grass/iostream/minmaxheap.h
Original file line number Diff line number Diff line change
Expand Up @@ -780,8 +780,8 @@ void BasicMinMaxHeap<T>::verify()
template <class T>
class MinMaxHeap : public BasicMinMaxHeap<T> {
public:
MinMaxHeap(HeapIndex size) : BasicMinMaxHeap<T>(size){};
virtual ~MinMaxHeap(){};
MinMaxHeap(HeapIndex size) : BasicMinMaxHeap<T>(size) {};
virtual ~MinMaxHeap() {};
bool full(void) const { return this->size() >= this->maxsize; };
HeapIndex get_maxsize() const { return this->maxsize; };
HeapIndex fill(T *arr, HeapIndex n);
Expand Down Expand Up @@ -822,9 +822,9 @@ HeapIndex MinMaxHeap<T>::fill(T *arr, HeapIndex n)
template <class T>
class UnboundedMinMaxHeap : public BasicMinMaxHeap<T> {
public:
UnboundedMinMaxHeap() : BasicMinMaxHeap<T>(MMHEAP_INITIAL_SIZE){};
UnboundedMinMaxHeap(HeapIndex size) : BasicMinMaxHeap<T>(size){};
virtual ~UnboundedMinMaxHeap(){};
UnboundedMinMaxHeap() : BasicMinMaxHeap<T>(MMHEAP_INITIAL_SIZE) {};
UnboundedMinMaxHeap(HeapIndex size) : BasicMinMaxHeap<T>(size) {};
virtual ~UnboundedMinMaxHeap() {};

protected:
virtual void grow();
Expand Down
2 changes: 1 addition & 1 deletion include/grass/iostream/replacementHeap.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class HeapElement {
T value;
AMI_STREAM<T> *run;

HeapElement() : run(NULL){};
HeapElement() : run(NULL) {};

friend ostream &operator<<(ostream &s, const HeapElement &p)
{
Expand Down
2 changes: 1 addition & 1 deletion include/grass/iostream/replacementHeapBlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class BlockHeapElement {
T value;
MEM_STREAM<T> *run;

BlockHeapElement() : run(NULL){};
BlockHeapElement() : run(NULL) {};

friend ostream &operator<<(ostream &s, const BlockHeapElement &p)
{
Expand Down
16 changes: 8 additions & 8 deletions include/grass/iostream/rtimer.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,17 @@ typedef struct {
time_t tv1, tv2;
} Rtimer;

#define rt_start(rt) \
if ((time(&(rt.tv1)) == ((time_t)-1))) { \
perror("time"); \
exit(1); \
#define rt_start(rt) \
if ((time(&(rt.tv1)) == ((time_t) - 1))) { \
perror("time"); \
exit(1); \
}

/* doesn't really stop, just updates endtimes */
#define rt_stop(rt) \
if ((time(&(rt.tv2)) == ((time_t)-1))) { \
perror("time"); \
exit(1); \
#define rt_stop(rt) \
if ((time(&(rt.tv2)) == ((time_t) - 1))) { \
perror("time"); \
exit(1); \
}

#define rt_u_useconds(rt) rt_w_useconds(rt)
Expand Down
2 changes: 1 addition & 1 deletion lib/datetime/incr1.c
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ static int _datetime_carry(DateTime *dt, int absolute)
dt->month++;

} /* end while */
} /* end if */
} /* end if */

/* undo giving year a SIGN, temporarily */
if (!absolute && dt->mode == DATETIME_ABSOLUTE) {
Expand Down
2 changes: 1 addition & 1 deletion lib/display/symbol.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ static void symbol(const SYMBOL *Symb, double x0, double y0,
break;

} /* switch */
} /* for loop */
} /* for loop */
}

/*!
Expand Down
2 changes: 1 addition & 1 deletion lib/external/parson/parson.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
#define IS_NUMBER_INVALID(x) (((x) * 0.0) != 0.0)
#endif

#define OBJECT_INVALID_IX ((size_t)-1)
#define OBJECT_INVALID_IX ((size_t) - 1)

static JSON_Malloc_Function parson_malloc = malloc;
static JSON_Free_Function parson_free = free;
Expand Down
10 changes: 5 additions & 5 deletions lib/gis/lz4.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ extern "C" {
#if defined(LZ4_DLL_EXPORT) && (LZ4_DLL_EXPORT == 1)
#define LZ4LIB_API __declspec(dllexport) LZ4LIB_VISIBILITY
#elif defined(LZ4_DLL_IMPORT) && (LZ4_DLL_IMPORT == 1)
#define LZ4LIB_API \
__declspec(dllimport) \
LZ4LIB_VISIBILITY /* It isn't required but allows generating better \
code, saving a function pointer load from the IAT \
and an indirect jump. */
#define LZ4LIB_API \
__declspec(dllimport) \
LZ4LIB_VISIBILITY /* It isn't required but allows generating better \
code, saving a function pointer load from the IAT \
and an indirect jump. */
#else
#define LZ4LIB_API LZ4LIB_VISIBILITY
#endif
Expand Down
6 changes: 3 additions & 3 deletions lib/gis/plot.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,11 @@ void G_setup_fill(int gap)
st->row_fill = row_solid_fill;
}

#define X(e) (st->left + st->xconv * ((e)-st->window.west))
#define X(e) (st->left + st->xconv * ((e) - st->window.west))
#define Y(n) (st->top + st->yconv * (st->window.north - (n)))

#define EAST(x) (st->window.west + ((x)-st->left) / st->xconv)
#define NORTH(y) (st->window.north - ((y)-st->top) / st->yconv)
#define EAST(x) (st->window.west + ((x) - st->left) / st->xconv)
#define NORTH(y) (st->window.north - ((y) - st->top) / st->yconv)

/*!
* \brief Converts east,north to x,y
Expand Down
2 changes: 1 addition & 1 deletion lib/gmath/findzc.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ int G_math_findzc(double conv[], int size, double zc[], double thresh,
break; /* quit looking at neighbors */
}
} /* for ni */
} /* for p */
} /* for p */
}

return 0;
Expand Down
2 changes: 1 addition & 1 deletion lib/gmath/la.c
Original file line number Diff line number Diff line change
Expand Up @@ -1265,7 +1265,7 @@ double G_vector_norm_maxval(vec_struct *vc, int vflag)
xval = *curpt;
}
} /* switch */
} /* if(curpt != startpt) */
} /* if(curpt != startpt) */

curpt += incr;
ncells--;
Expand Down
2 changes: 1 addition & 1 deletion lib/imagery/georef.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ struct MATRIX {

/* CALCULATE OFFSET INTO ARRAY BASED ON R/C */

#define M(row, col) m->v[(((row)-1) * (m->n)) + (col)-1]
#define M(row, col) m->v[(((row) - 1) * (m->n)) + (col) - 1]

#define MSUCCESS 1 /* SUCCESS */
#define MNPTERR 0 /* NOT ENOUGH POINTS */
Expand Down
2 changes: 1 addition & 1 deletion lib/imagery/georef_tps.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct MATRIX {

/* CALCULATE OFFSET INTO ARRAY BASED ON R/C */

#define M(row, col) m->v[(((row)-1) * (m->n)) + (col)-1]
#define M(row, col) m->v[(((row) - 1) * (m->n)) + (col) - 1]

#define MSUCCESS 1 /* SUCCESS */
#define MNPTERR 0 /* NOT ENOUGH POINTS */
Expand Down
2 changes: 1 addition & 1 deletion lib/lidar/raster.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,6 @@ int P_Regular_Points(struct Cell_head *Elaboration, struct Cell_head *Original,
Segment_put(out_seg, &dval, row, col);
}
} /* END COL */
} /* END ROW */
} /* END ROW */
return 1;
}
48 changes: 22 additions & 26 deletions lib/nviz/render.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,21 +158,19 @@ int Nviz_create_render_window(struct render_window *rwin, void *display UNUSED,
int width, int height)
{
#if defined(OPENGL_X11)
int attributeList[] = {
GLX_RGBA,
GLX_RED_SIZE,
1,
GLX_GREEN_SIZE,
1,
GLX_BLUE_SIZE,
1,
GLX_DEPTH_SIZE,
1,
int attributeList[] = {GLX_RGBA,
GLX_RED_SIZE,
1,
GLX_GREEN_SIZE,
1,
GLX_BLUE_SIZE,
1,
GLX_DEPTH_SIZE,
1,
#if !defined(OPENGL_FBO)
GLX_DOUBLEBUFFER,
GLX_DOUBLEBUFFER,
#endif
None
};
None};
XVisualInfo *v;

rwin->displayId = XOpenDisplay((char *)display);
Expand Down Expand Up @@ -205,21 +203,19 @@ int Nviz_create_render_window(struct render_window *rwin, void *display UNUSED,
XFree(v);
#elif defined(OPENGL_AQUA)
#if defined(OPENGL_AGL)
int attributeList[] = {
AGL_RGBA,
AGL_RED_SIZE,
1,
AGL_GREEN_SIZE,
1,
AGL_BLUE_SIZE,
1,
AGL_DEPTH_SIZE,
1,
int attributeList[] = {AGL_RGBA,
AGL_RED_SIZE,
1,
AGL_GREEN_SIZE,
1,
AGL_BLUE_SIZE,
1,
AGL_DEPTH_SIZE,
1,
#if !defined(OPENGL_FBO)
AGL_DOUBLEBUFFER,
AGL_DOUBLEBUFFER,
#endif
AGL_NONE
};
AGL_NONE};

/* TODO: open mac display */

Expand Down
4 changes: 2 additions & 2 deletions lib/ogsf/gsd_surf.c
Original file line number Diff line number Diff line change
Expand Up @@ -2039,7 +2039,7 @@ int gsd_norm_arrows(geosurf *surf)
cnt++;
}
} /* ea col */
} /* ea row */
} /* ea row */
gsd_popmatrix();

return (1);
Expand Down Expand Up @@ -2355,7 +2355,7 @@ int gsd_surf_map(geosurf *surf)
} /* close ii loop */
gsd_endtfan();
} /* end col */
} /* end row */
} /* end row */

gsd_popmatrix();
gsd_blend(0);
Expand Down
2 changes: 1 addition & 1 deletion lib/ogsf/gsd_wire.c
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ int gsd_wire_arrows(geosurf *surf)

gsd_arrow(pt, curcolor, xres * 2, n, sz, surf);
} /* ea col */
} /* ea row */
} /* ea row */

gsd_popmatrix();
gsd_colormode(CM_DIFFUSE);
Expand Down
6 changes: 3 additions & 3 deletions lib/ogsf/gsget.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@

/* cast to float, otherwise doesn't seem to handle neg. values */

#define SCALE_ATT(att, val, low, high) \
((val) <= att->max_nz && (val) >= att->min_nz && att->range_nz \
? (((val)-att->min_nz) / att->range_nz) * ((high) - (low)) + (low) \
#define SCALE_ATT(att, val, low, high) \
((val) <= att->max_nz && (val) >= att->min_nz && att->range_nz \
? (((val) - att->min_nz) / att->range_nz) * ((high) - (low)) + (low) \
: 0)

#define GET_MAPATT(buff, offset, att) (get_mapatt(buff, offset, &(att)))
Expand Down
Loading

0 comments on commit 0d5d274

Please sign in to comment.