Skip to content

Commit d6ce514

Browse files
Merge pull request #170 from insertinterestingnamehere/warnings
Fix Warnings
2 parents e71f534 + 8b9d3e3 commit d6ce514

39 files changed

+148
-197
lines changed

.github/workflows/CI.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ jobs:
133133
env:
134134
CC: icc
135135
CXX: icpc
136+
CFLAGS: "-diag-disable=10441"
137+
CXXFLAGS: "-diag-disable=10441"
136138
steps:
137139
- uses: actions/checkout@v3
138140
- if: ${{ matrix.topology != 'no' }}

config/qthread_check_FUNCTION.m4

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ AC_DEFUN([QTHREAD_CHECK_FUNCTION],
77
[qt_cv_c99_FUNCTION],
88
[AC_TRY_COMPILE(
99
[#include <stdio.h>
10-
void foo(void) { printf("%s\n", __FUNCTION__); }],
10+
static void foo(void) { printf("%s\n", __FUNCTION__); }],
1111
[foo(); return 0;],
1212
[qt_cv_c99_FUNCTION=yes],
1313
[qt_cv_c99_FUNCTION=no])])
@@ -16,7 +16,7 @@ void foo(void) { printf("%s\n", __FUNCTION__); }],
1616
[qt_cv_c99_func],
1717
[AC_TRY_COMPILE(
1818
[#include <stdio.h>
19-
void foo(void) { printf("%s\n", __func__); }],
19+
static void foo(void) { printf("%s\n", __func__); }],
2020
[foo(); return 0;],
2121
[qt_cv_c99_func=yes],
2222
[qt_cv_c99_func=no])])

config/qthread_check_assembly.m4

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ AC_DEFUN([QTHREAD_CHECK_INLINE_C_GCC],[
133133
asm_result="unknown"
134134
AS_IF([test ! "$assembly" = ""],
135135
[AC_RUN_IFELSE([AC_LANG_SOURCE([[
136-
int main() {
136+
int main(void) {
137137
int ret = 1;
138138
__asm__ __volatile__ ($assembly);
139139
return ret;
@@ -145,7 +145,7 @@ return ret;
145145
# if we're cross compiling, just try to compile and figure good enough
146146
AS_IF([test "$asm_result" = "unknown"],
147147
[AC_LINK_IFELSE([AC_LANG_SOURCE([[
148-
int main()
148+
int main(void)
149149
{
150150
int ret = 1;
151151
__asm__ __volatile__ ($assembly);

config/qthread_check_atomics.m4

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ AC_CACHE_CHECK([whether compiler supports builtin atomic CAS-32],
2929
#include <stdlib.h>
3030
#include <stdint.h> /* for uint32_t */
3131
32-
int main()
32+
int main(void)
3333
{
3434
uint32_t bar=1, old=1, new=2;
3535
uint32_t foo = __sync_val_compare_and_swap(&bar, old, new);
@@ -48,7 +48,7 @@ AC_CACHE_CHECK([whether compiler supports builtin atomic CAS-64],
4848
#include <stdlib.h>
4949
#include <stdint.h> /* for uint64_t */
5050
51-
int main()
51+
int main(void)
5252
{
5353
uint64_t bar=1, old=1, new=2;
5454
uint64_t foo = __sync_val_compare_and_swap(&bar, old, new);
@@ -66,7 +66,7 @@ AC_CACHE_CHECK([whether compiler supports builtin atomic CAS-ptr],
6666
#endif
6767
#include <stdlib.h>
6868
69-
int main()
69+
int main(void)
7070
{
7171
void *bar=(void*)1, *old=(void*)1, *new=(void*)2;
7272
void *foo = __sync_val_compare_and_swap(&bar, old, new);
@@ -138,7 +138,7 @@ AC_CACHE_CHECK([whether compiler supports builtin atomic incr],
138138
#include <stdlib.h>
139139
#include <stdint.h> /* for uint64_t */
140140
141-
int main()
141+
int main(void)
142142
{
143143
uint64_t bar=1;
144144
uint64_t foo = __sync_fetch_and_add(&bar, 1);
@@ -155,7 +155,7 @@ return foo;
155155
#include <stdlib.h>
156156
#include <stdint.h> /* for uint32_t */
157157
158-
int main()
158+
int main(void)
159159
{
160160
uint32_t bar=1;
161161
uint32_t foo = __sync_fetch_and_add(&bar, 1);
@@ -180,7 +180,6 @@ AS_IF([test "$qthread_cv_atomic_incr" = "yes"],
180180
int main(int argc, char *argv[])
181181
{
182182
uint64_t master = 0;
183-
uint64_t test;
184183
if ((__sync_fetch_and_add(&master, 1) != 0) || (master != 1)) {
185184
return -1;
186185
}
@@ -213,7 +212,7 @@ return 0;
213212
#include <stdlib.h>
214213
#include <stdint.h> /* for uint32_t */
215214
216-
int main()
215+
int main(void)
217216
{
218217
uint64_t master = 0;
219218
if ((__sync_fetch_and_add(&master, 1) != 0) || (master != 1)) {
@@ -231,7 +230,7 @@ AS_IF([test "$qthread_cv_atomic_CAS" = "yes"],
231230
[AC_LINK_IFELSE([AC_LANG_SOURCE([[
232231
#include <stdlib.h>
233232
234-
int main()
233+
int main(void)
235234
{
236235
long bar=1, old=1, new=2;
237236
long foo = __sync_val_compare_and_swap(&bar, old, new);

config/qthread_check_attributes.m4

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ AC_CACHE_CHECK(
1111
[qt_cv_aligned_attr],
1212
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
1313
int foo __attribute__((aligned(64)));
14+
int f(int i);
1415
int f(int i) { foo = 1; return foo; }]])],
1516
[qt_cv_aligned_attr=yes],
1617
[qt_cv_aligned_attr=no])])
@@ -25,8 +26,10 @@ AC_CACHE_CHECK(
2526
[support for __attribute__((malloc))],
2627
[qt_cv_malloc_attr],
2728
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
28-
__attribute__((malloc))
29-
void * f(int i) { return malloc(i); }]])],
29+
#include <stdlib.h>
30+
__attribute__((malloc)) void * f(int i);
31+
__attribute__((malloc)) void * f(int i)
32+
{ return malloc(i); }]])],
3033
[qt_cv_malloc_attr=yes],
3134
[qt_cv_malloc_attr=no])])
3235
AS_IF([test "x$qt_cv_malloc_attr" = xyes],
@@ -42,7 +45,7 @@ AC_CACHE_CHECK(
4245
[support for __attribute__((unused))],
4346
[qt_cv_unused_attr],
4447
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
45-
__attribute__((unused))
48+
static __attribute__((unused))
4649
int f(int i) { return i; }]])],
4750
[qt_cv_unused_attr=yes],
4851
[qt_cv_unused_attr=no])])
@@ -60,8 +63,10 @@ AC_CACHE_CHECK(
6063
[support for __attribute__((noinline))],
6164
[qt_cv_noinline_attr],
6265
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
63-
__attribute__((noinline))
64-
void * f(int i) { return malloc(i); }]])],
66+
#include <stdlib.h>
67+
__attribute__((noinline)) void * f(int i);
68+
__attribute__((noinline)) void * f(int i)
69+
{ return malloc(i); }]])],
6570
[qt_cv_noinline_attr=yes],
6671
[qt_cv_noinline_attr=no])])
6772
AS_IF([test "x$qt_cv_noinline_attr" = xyes],
@@ -77,6 +82,8 @@ AC_CACHE_CHECK(
7782
[support for __attribute__((deprecated))],
7883
[qt_cv_deprecated_attr],
7984
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
85+
#include <stdlib.h>
86+
void * __attribute__((deprecated)) f (int i);
8087
void * __attribute__((deprecated)) f (int i)
8188
{ return malloc(i); }]])],
8289
[qt_cv_deprecated_attr=yes],

config/qthread_check_bitfield_order.m4

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ union foo {
2727
unsigned b : 3;
2828
unsigned c : 1;
2929
} s;
30-
} fb;]],
31-
[[
32-
struct sigaction sa;
33-
void handler (int sig, siginfo_t* s, void* v)
30+
} fb;
31+
static void handler (int sig, siginfo_t* s, void* v)
3432
{
3533
_exit(1);
36-
}
34+
}]],
35+
[[
36+
struct sigaction sa;
3737
3838
memset (&sa, '\0', sizeof(sa));
3939
sa.sa_sigaction = &handler;

config/qthread_check_pthreads.m4

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ AC_CACHE_CHECK(
1111
[qt_cv_pthread_process_private],
1212
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
1313
#include <pthread.h>
14-
pthread_mutex_t foo;
15-
int f(int i) { pthread_mutex_init(&foo, PTHREAD_PROCESS_PRIVATE); }]])],
14+
int val = PTHREAD_PROCESS_PRIVATE;
15+
]])],
1616
[qt_cv_pthread_process_private=yes],
1717
[qt_cv_pthread_process_private=no])])
1818
AS_IF([test "x$qt_cv_pthread_process_private" = xyes],

config/qthread_check_qsort.m4

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,18 @@ AC_CHECK_FUNCS([qsort_r],
2222
2323
struct sigaction sa;
2424
25-
int cmp(void *a, const void *b, const void*c)
25+
static int cmp(void *a, const void *b, const void*c)
2626
{
2727
assert(a == NULL);
2828
return *(int*)b - *(int*)c;
2929
}
3030
31-
void handler(int sig, siginfo_t* s, void* v)
31+
static void handler(int sig, siginfo_t* s, void* v)
3232
{
3333
_exit(1);
3434
}
3535
36-
void register_handle()
36+
static void register_handle(void)
3737
{
3838
memset (&sa, '\0', sizeof(sa));
3939
sa.sa_sigaction = &handler;
@@ -42,7 +42,7 @@ void register_handle()
4242
sigaction(SIGSEGV, &sa, NULL);
4343
}
4444
45-
int main()
45+
int main(void)
4646
{
4747
int array[5] = {7,3,5,2,8};
4848
int i;

config/qthread_check_working_valloc.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ AC_DEFUN([QTHREAD_CHECK_WORKING_VALLOC],
1717
# include <unistd.h>
1818
#endif
1919
20-
int main()
20+
int main(void)
2121
{
2222
int i;
2323
char * allocs[100];

include/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ noinst_HEADERS = \
3636
qt_int_log.h \
3737
qt_io.h \
3838
qt_feb.h \
39+
qt_locks.h \
3940
qt_syncvar.h \
4041
qt_macros.h \
4142
qt_mpool.h \

0 commit comments

Comments
 (0)