Skip to content

Commit dbbd240

Browse files
authored
Problem: clang-format CI job fails
Solution: update to clang-format-18 and apply diff Co-authored-by: chris cunningham <[email protected]>
1 parent b91a620 commit dbbd240

File tree

16 files changed

+92
-122
lines changed

16 files changed

+92
-122
lines changed

.github/workflows/CI.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
- os: ubuntu-latest
6767
BUILD_TYPE: cmake
6868
DRAFT: enabled
69-
PACKAGES: cmake clang-format-11
69+
PACKAGES: cmake clang-format-18
7070
DO_CLANG_FORMAT_CHECK: 1
7171
- os: ubuntu-latest
7272
BUILD_TYPE: default
@@ -223,7 +223,7 @@ jobs:
223223
CLANG_TIDY: clang-tidy
224224
steps:
225225
- name: Add debian packages
226-
run: apt-get install --yes clang-tidy clang-tools
226+
run: sudo apt-get install --yes clang-tidy clang-tools
227227
- name: build
228228
shell: bash
229229
working-directory: libzmq

builds/cmake/ci_build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ mkdir build_cmake
9090
cd build_cmake
9191
if [ "$DO_CLANG_FORMAT_CHECK" = "1" ] ; then
9292
if ! ( PKG_CONFIG_PATH=${BUILD_PREFIX}/lib/pkgconfig cmake "${CMAKE_OPTS[@]}" .. && make clang-format-check) ; then
93+
echo "clang-format version is: $(clang-format --version)"
9394
make clang-format-diff
9495
exit 1
9596
fi

include/zmq.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#define ZMQ_VERSION_PATCH 6
1818

1919
#define ZMQ_MAKE_VERSION(major, minor, patch) \
20-
((major) *10000 + (minor) *100 + (patch))
20+
((major) * 10000 + (minor) * 100 + (patch))
2121
#define ZMQ_VERSION \
2222
ZMQ_MAKE_VERSION (ZMQ_VERSION_MAJOR, ZMQ_VERSION_MINOR, ZMQ_VERSION_PATCH)
2323

@@ -39,9 +39,9 @@ extern "C" {
3939
#if defined ZMQ_STATIC
4040
#define ZMQ_EXPORT
4141
#elif defined DLL_EXPORT
42-
#define ZMQ_EXPORT __declspec(dllexport)
42+
#define ZMQ_EXPORT __declspec (dllexport)
4343
#else
44-
#define ZMQ_EXPORT __declspec(dllimport)
44+
#define ZMQ_EXPORT __declspec (dllimport)
4545
#endif
4646
#else
4747
#if defined __SUNPRO_C || defined __SUNPRO_CC
@@ -218,10 +218,10 @@ ZMQ_EXPORT int zmq_ctx_destroy (void *context_);
218218
typedef struct zmq_msg_t
219219
{
220220
#if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_ARM64))
221-
__declspec(align (8)) unsigned char _[64];
221+
__declspec (align (8)) unsigned char _[64];
222222
#elif defined(_MSC_VER) \
223223
&& (defined(_M_IX86) || defined(_M_ARM_ARMV7VE) || defined(_M_ARM))
224-
__declspec(align (4)) unsigned char _[64];
224+
__declspec (align (4)) unsigned char _[64];
225225
#elif defined(__GNUC__) || defined(__INTEL_COMPILER) \
226226
|| (defined(__SUNPRO_C) && __SUNPRO_C >= 0x590) \
227227
|| (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x590)

src/atomic_counter.hpp

Lines changed: 33 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ namespace zmq
5454
// mutexes).
5555

5656
#if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_ARM64))
57-
class __declspec(align (8)) atomic_counter_t
57+
class __declspec (align (8)) atomic_counter_t
5858
#elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_ARM_ARMV7VE))
59-
class __declspec(align (4)) atomic_counter_t
59+
class __declspec (align (4)) atomic_counter_t
6060
#else
6161
class atomic_counter_t
6262
#endif
@@ -86,23 +86,23 @@ class atomic_counter_t
8686
#elif defined ZMQ_ATOMIC_COUNTER_TILE
8787
old_value = arch_atomic_add (&_value, increment_);
8888
#elif defined ZMQ_ATOMIC_COUNTER_X86
89-
__asm__ volatile("lock; xadd %0, %1 \n\t"
90-
: "=r"(old_value), "=m"(_value)
91-
: "0"(increment_), "m"(_value)
92-
: "cc", "memory");
89+
__asm__ volatile ("lock; xadd %0, %1 \n\t"
90+
: "=r"(old_value), "=m"(_value)
91+
: "0"(increment_), "m"(_value)
92+
: "cc", "memory");
9393
#elif defined ZMQ_ATOMIC_COUNTER_ARM
9494
integer_t flag, tmp;
95-
__asm__ volatile(" dmb sy\n\t"
96-
"1: ldrex %0, [%5]\n\t"
97-
" add %2, %0, %4\n\t"
98-
" strex %1, %2, [%5]\n\t"
99-
" teq %1, #0\n\t"
100-
" bne 1b\n\t"
101-
" dmb sy\n\t"
102-
: "=&r"(old_value), "=&r"(flag), "=&r"(tmp),
103-
"+Qo"(_value)
104-
: "Ir"(increment_), "r"(&_value)
105-
: "cc");
95+
__asm__ volatile (" dmb sy\n\t"
96+
"1: ldrex %0, [%5]\n\t"
97+
" add %2, %0, %4\n\t"
98+
" strex %1, %2, [%5]\n\t"
99+
" teq %1, #0\n\t"
100+
" bne 1b\n\t"
101+
" dmb sy\n\t"
102+
: "=&r"(old_value), "=&r"(flag), "=&r"(tmp),
103+
"+Qo"(_value)
104+
: "Ir"(increment_), "r"(&_value)
105+
: "cc");
106106
#elif defined ZMQ_ATOMIC_COUNTER_MUTEX
107107
sync.lock ();
108108
old_value = _value;
@@ -140,24 +140,24 @@ class atomic_counter_t
140140
#elif defined ZMQ_ATOMIC_COUNTER_X86
141141
integer_t oldval = -decrement_;
142142
volatile integer_t *val = &_value;
143-
__asm__ volatile("lock; xaddl %0,%1"
144-
: "=r"(oldval), "=m"(*val)
145-
: "0"(oldval), "m"(*val)
146-
: "cc", "memory");
143+
__asm__ volatile ("lock; xaddl %0,%1"
144+
: "=r"(oldval), "=m"(*val)
145+
: "0"(oldval), "m"(*val)
146+
: "cc", "memory");
147147
return oldval != decrement_;
148148
#elif defined ZMQ_ATOMIC_COUNTER_ARM
149149
integer_t old_value, flag, tmp;
150-
__asm__ volatile(" dmb sy\n\t"
151-
"1: ldrex %0, [%5]\n\t"
152-
" sub %2, %0, %4\n\t"
153-
" strex %1, %2, [%5]\n\t"
154-
" teq %1, #0\n\t"
155-
" bne 1b\n\t"
156-
" dmb sy\n\t"
157-
: "=&r"(old_value), "=&r"(flag), "=&r"(tmp),
158-
"+Qo"(_value)
159-
: "Ir"(decrement_), "r"(&_value)
160-
: "cc");
150+
__asm__ volatile (" dmb sy\n\t"
151+
"1: ldrex %0, [%5]\n\t"
152+
" sub %2, %0, %4\n\t"
153+
" strex %1, %2, [%5]\n\t"
154+
" teq %1, #0\n\t"
155+
" bne 1b\n\t"
156+
" dmb sy\n\t"
157+
: "=&r"(old_value), "=&r"(flag), "=&r"(tmp),
158+
"+Qo"(_value)
159+
: "Ir"(decrement_), "r"(&_value)
160+
: "cc");
161161
return old_value - decrement_ != 0;
162162
#elif defined ZMQ_ATOMIC_COUNTER_MUTEX
163163
sync.lock ();
@@ -170,10 +170,7 @@ class atomic_counter_t
170170
#endif
171171
}
172172

173-
integer_t get () const ZMQ_NOEXCEPT
174-
{
175-
return _value;
176-
}
173+
integer_t get () const ZMQ_NOEXCEPT { return _value; }
177174

178175
private:
179176
#if defined ZMQ_ATOMIC_COUNTER_CXX11

src/atomic_ptr.hpp

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -60,22 +60,22 @@ inline void *atomic_xchg_ptr (void **ptr_,
6060
return arch_atomic_exchange (ptr_, val_);
6161
#elif defined ZMQ_ATOMIC_PTR_X86
6262
void *old;
63-
__asm__ volatile("lock; xchg %0, %2"
64-
: "=r"(old), "=m"(*ptr_)
65-
: "m"(*ptr_), "0"(val_));
63+
__asm__ volatile ("lock; xchg %0, %2"
64+
: "=r"(old), "=m"(*ptr_)
65+
: "m"(*ptr_), "0"(val_));
6666
return old;
6767
#elif defined ZMQ_ATOMIC_PTR_ARM
6868
void *old;
6969
unsigned int flag;
70-
__asm__ volatile(" dmb sy\n\t"
71-
"1: ldrex %1, [%3]\n\t"
72-
" strex %0, %4, [%3]\n\t"
73-
" teq %0, #0\n\t"
74-
" bne 1b\n\t"
75-
" dmb sy\n\t"
76-
: "=&r"(flag), "=&r"(old), "+Qo"(*ptr_)
77-
: "r"(ptr_), "r"(val_)
78-
: "cc");
70+
__asm__ volatile (" dmb sy\n\t"
71+
"1: ldrex %1, [%3]\n\t"
72+
" strex %0, %4, [%3]\n\t"
73+
" teq %0, #0\n\t"
74+
" bne 1b\n\t"
75+
" dmb sy\n\t"
76+
: "=&r"(flag), "=&r"(old), "+Qo"(*ptr_)
77+
: "r"(ptr_), "r"(val_)
78+
: "cc");
7979
return old;
8080
#elif defined ZMQ_ATOMIC_PTR_MUTEX
8181
_sync.lock ();
@@ -111,26 +111,26 @@ inline void *atomic_cas (void *volatile *ptr_,
111111
return arch_atomic_val_compare_and_exchange (ptr_, cmp_, val_);
112112
#elif defined ZMQ_ATOMIC_PTR_X86
113113
void *old;
114-
__asm__ volatile("lock; cmpxchg %2, %3"
115-
: "=a"(old), "=m"(*ptr_)
116-
: "r"(val_), "m"(*ptr_), "0"(cmp_)
117-
: "cc");
114+
__asm__ volatile ("lock; cmpxchg %2, %3"
115+
: "=a"(old), "=m"(*ptr_)
116+
: "r"(val_), "m"(*ptr_), "0"(cmp_)
117+
: "cc");
118118
return old;
119119
#elif defined ZMQ_ATOMIC_PTR_ARM
120120
void *old;
121121
unsigned int flag;
122-
__asm__ volatile(" dmb sy\n\t"
123-
"1: ldrex %1, [%3]\n\t"
124-
" mov %0, #0\n\t"
125-
" teq %1, %4\n\t"
126-
" it eq\n\t"
127-
" strexeq %0, %5, [%3]\n\t"
128-
" teq %0, #0\n\t"
129-
" bne 1b\n\t"
130-
" dmb sy\n\t"
131-
: "=&r"(flag), "=&r"(old), "+Qo"(*ptr_)
132-
: "r"(ptr_), "r"(cmp_), "r"(val_)
133-
: "cc");
122+
__asm__ volatile (" dmb sy\n\t"
123+
"1: ldrex %1, [%3]\n\t"
124+
" mov %0, #0\n\t"
125+
" teq %1, %4\n\t"
126+
" it eq\n\t"
127+
" strexeq %0, %5, [%3]\n\t"
128+
" teq %0, #0\n\t"
129+
" bne 1b\n\t"
130+
" dmb sy\n\t"
131+
: "=&r"(flag), "=&r"(old), "+Qo"(*ptr_)
132+
: "r"(ptr_), "r"(cmp_), "r"(val_)
133+
: "cc");
134134
return old;
135135
#elif defined ZMQ_ATOMIC_PTR_MUTEX
136136
_sync.lock ();

src/blob.hpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ struct blob_t
8989
unsigned char *data () { return _data; }
9090

9191
// Defines an order relationship on blob_t.
92-
bool operator<(blob_t const &other_) const
92+
bool operator< (blob_t const &other_) const
9393
{
9494
const int cmpres =
9595
memcmp (_data, other_._data, std::min (_size, other_._size));
@@ -161,10 +161,7 @@ struct blob_t
161161
return *this;
162162
}
163163
#else
164-
blob_t (const blob_t &other) : _owned (false)
165-
{
166-
set_deep_copy (other);
167-
}
164+
blob_t (const blob_t &other) : _owned (false) { set_deep_copy (other); }
168165
blob_t &operator= (const blob_t &other)
169166
{
170167
if (this != &other) {

src/clock.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,11 +225,11 @@ uint64_t zmq::clock_t::rdtsc ()
225225
return _ReadStatusReg (pmccntr_el0);
226226
#elif (defined(_WIN32) && defined(__GNUC__) && defined(__aarch64__))
227227
uint64_t val;
228-
__asm__ volatile("mrs %0, pmccntr_el0" : "=r"(val));
228+
__asm__ volatile ("mrs %0, pmccntr_el0" : "=r"(val));
229229
return val;
230230
#elif (defined __GNUC__ && (defined __i386__ || defined __x86_64__))
231231
uint32_t low, high;
232-
__asm__ volatile("rdtsc" : "=a"(low), "=d"(high));
232+
__asm__ volatile ("rdtsc" : "=a"(low), "=d"(high));
233233
return static_cast<uint64_t> (high) << 32 | low;
234234
#elif (defined __SUNPRO_CC && (__SUNPRO_CC >= 0x5100) \
235235
&& (defined __i386 || defined __amd64 || defined __x86_64))
@@ -238,11 +238,11 @@ uint64_t zmq::clock_t::rdtsc ()
238238
uint64_t u64val;
239239
uint32_t u32val[2];
240240
} tsc;
241-
asm("rdtsc" : "=a"(tsc.u32val[0]), "=d"(tsc.u32val[1]));
241+
asm ("rdtsc" : "=a"(tsc.u32val[0]), "=d"(tsc.u32val[1]));
242242
return tsc.u64val;
243243
#elif defined(__s390__)
244244
uint64_t tsc;
245-
asm("\tstck\t%0\n" : "=Q"(tsc) : : "cc");
245+
asm ("\tstck\t%0\n" : "=Q"(tsc) : : "cc");
246246
return tsc;
247247
#else
248248
struct timespec ts;

src/err.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ void zmq_abort (const char *errmsg_) __attribute__ ((analyzer_noreturn));
3636
void zmq_abort (const char *errmsg_);
3737
#endif
3838
#elif defined __MSCVER__
39-
__declspec(noreturn) void zmq_abort (const char *errmsg_);
39+
__declspec (noreturn) void zmq_abort (const char *errmsg_);
4040
#else
4141
void zmq_abort (const char *errmsg_);
4242
#endif

src/mailbox.hpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,7 @@ class mailbox_t ZMQ_FINAL : public i_mailbox
3131
// close the file descriptors in the signaller. This is used in a forked
3232
// child process to close the file descriptors so that they do not interfere
3333
// with the context in the parent process.
34-
void forked () ZMQ_FINAL
35-
{
36-
_signaler.forked ();
37-
}
34+
void forked () ZMQ_FINAL { _signaler.forked (); }
3835
#endif
3936

4037
private:

src/norm_engine.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ void zmq::norm_engine_t::recv_data (NormObjectHandle object)
629629
else // Move back to "rx_pending" list until NORM_RX_OBJECT_UPDATED
630630
msg_ready_list.Append (*rxState);
631631
} // end while(NULL != (rxState = iterator.GetNextItem()))
632-
} // end if (zmq_input_ready)
632+
} // end if (zmq_input_ready)
633633
} // end while ((!rx_ready_list.empty() || (zmq_input_ready && !msg_ready_list.empty()))
634634

635635
// Alert zmq of the messages we have pushed up

0 commit comments

Comments
 (0)