Skip to content

Commit

Permalink
[src] Use pragma only when relevant (GCC >= 12)
Browse files Browse the repository at this point in the history
Using `-Wno-pragmas` would still cause issues when building with `-Werror`.
  • Loading branch information
giordano committed Jun 17, 2022
1 parent a7233cb commit 78e3e57
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ FLAGS := \
-I$(LIBUV_INC) -I$(build_includedir) \
-I$(JULIAHOME)/deps/valgrind
FLAGS += -Wall -Wno-strict-aliasing -fno-omit-frame-pointer -fvisibility=hidden -fno-common \
-Wno-comment -Wpointer-arith -Wundef -Wno-pragmas
-Wno-comment -Wpointer-arith -Wundef
ifeq ($(USEGCC),1) # GCC bug #25509 (void)__attribute__((warn_unused_result))
FLAGS += -Wno-unused-result
endif
Expand Down
8 changes: 7 additions & 1 deletion src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ void jl_init_stack_limits(int ismaster, void **stack_lo, void **stack_hi)
pthread_attr_destroy(&attr);
*stack_lo = (void*)stackaddr;
#pragma GCC diagnostic push
#if defined(_COMPILER_GCC_) && __GNUC__ >= 12
#pragma GCC diagnostic ignored "-Wdangling-pointer"
#endif
*stack_hi = (void*)&stacksize;
#pragma GCC diagnostic pop
return;
Expand Down Expand Up @@ -108,7 +110,9 @@ void jl_init_stack_limits(int ismaster, void **stack_lo, void **stack_hi)
# ifndef __clang_analyzer__
*stack_hi = (void*)&stacksize;
#pragma GCC diagnostic push
#if defined(_COMPILER_GCC_) && __GNUC__ >= 12
#pragma GCC diagnostic ignored "-Wdangling-pointer"
#endif
*stack_lo = (void*)((char*)*stack_hi - stacksize);
#pragma GCC diagnostic pop
# else
Expand Down Expand Up @@ -728,9 +732,11 @@ JL_DLLEXPORT void julia_init(JL_IMAGE_SEARCH rel)

jl_gc_init();
jl_ptls_t ptls = jl_init_threadtls(0);
// warning: this changes `jl_current_task`, so be careful not to call that from this function
#pragma GCC diagnostic push
#if defined(_COMPILER_GCC_) && __GNUC__ >= 12
#pragma GCC diagnostic ignored "-Wdangling-pointer"
#endif
// warning: this changes `jl_current_task`, so be careful not to call that from this function
jl_task_t *ct = jl_init_root_task(ptls, stack_lo, stack_hi);
#pragma GCC diagnostic pop
JL_GC_PROMISE_ROOTED(ct);
Expand Down

0 comments on commit 78e3e57

Please sign in to comment.