8338155: Fix -Wzero-as-null-pointer-constant warnings involving PTHREAD_MUTEX_INITIALIZER
Reviewed-by: dholmes, dlong
This commit is contained in:
parent
c27a8c8c8b
commit
73f7a5f15d
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -430,7 +430,10 @@ static int get_boot_time(uint64_t* time) {
|
||||
}
|
||||
|
||||
static int perf_context_switch_rate(double* rate) {
|
||||
PRAGMA_DIAG_PUSH
|
||||
PRAGMA_ZERO_AS_NULL_POINTER_CONSTANT_IGNORED
|
||||
static pthread_mutex_t contextSwitchLock = PTHREAD_MUTEX_INITIALIZER;
|
||||
PRAGMA_DIAG_POP
|
||||
static uint64_t bootTime;
|
||||
static uint64_t lastTimeNanos;
|
||||
static uint64_t lastSwitches;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2014 SAP SE. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -26,6 +26,7 @@
|
||||
#include "precompiled.hpp"
|
||||
#include "runtime/javaThread.hpp"
|
||||
#include "runtime/threadCritical.hpp"
|
||||
#include "utilities/compilerWarnings.hpp"
|
||||
|
||||
// put OS-includes here
|
||||
# include <pthread.h>
|
||||
@ -35,7 +36,12 @@
|
||||
//
|
||||
|
||||
static pthread_t tc_owner = 0;
|
||||
|
||||
PRAGMA_DIAG_PUSH
|
||||
PRAGMA_ZERO_AS_NULL_POINTER_CONSTANT_IGNORED
|
||||
static pthread_mutex_t tc_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
PRAGMA_DIAG_POP
|
||||
|
||||
static int tc_count = 0;
|
||||
|
||||
ThreadCritical::ThreadCritical() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -82,6 +82,10 @@
|
||||
#define PRAGMA_NONNULL_IGNORED
|
||||
#endif
|
||||
|
||||
#ifndef PRAGMA_ZERO_AS_NULL_POINTER_CONSTANT_IGNORED
|
||||
#define PRAGMA_ZERO_AS_NULL_POINTER_CONSTANT_IGNORED
|
||||
#endif
|
||||
|
||||
// Support warnings for use of certain C functions, except where explicitly
|
||||
// permitted.
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -67,6 +67,9 @@
|
||||
|
||||
#define PRAGMA_NONNULL_IGNORED PRAGMA_DISABLE_GCC_WARNING("-Wnonnull")
|
||||
|
||||
#define PRAGMA_ZERO_AS_NULL_POINTER_CONSTANT_IGNORED \
|
||||
PRAGMA_DISABLE_GCC_WARNING("-Wzero-as-null-pointer-constant")
|
||||
|
||||
#if (__GNUC__ >= 10)
|
||||
// TODO: Re-enable warning attribute for Clang once
|
||||
// https://github.com/llvm/llvm-project/issues/56519 is fixed and released.
|
||||
|
Loading…
Reference in New Issue
Block a user