8341336: Fix -Wzero-as-null-pointer-constant warnings in PRODUCT-only code

Reviewed-by: stefank, iwalulya, shade
This commit is contained in:
Kim Barrett 2024-10-02 21:58:26 +00:00
parent c43202baf6
commit dc0ce1b2f2
5 changed files with 10 additions and 10 deletions

View File

@ -29,6 +29,7 @@
#include "c1/c1_ValueType.hpp"
#include "oops/method.hpp"
#include "utilities/globalDefinitions.hpp"
#include "utilities/macros.hpp"
class BlockBegin;
class BlockList;
@ -1122,7 +1123,7 @@ class LIR_Op: public CompilationResourceObj {
}
#endif
virtual const char * name() const PRODUCT_RETURN0;
virtual const char * name() const PRODUCT_RETURN_NULL;
virtual void visit(LIR_OpVisitState* state);
int id() const { return _id; }
@ -1400,7 +1401,7 @@ class LIR_Op1: public LIR_Op {
virtual bool is_patching() { return _patch != lir_patch_none; }
virtual void emit_code(LIR_Assembler* masm);
virtual LIR_Op1* as_Op1() { return this; }
virtual const char * name() const PRODUCT_RETURN0;
virtual const char * name() const PRODUCT_RETURN_NULL;
void set_in_opr(LIR_Opr opr) { _opr = opr; }

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 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
@ -74,7 +74,7 @@ class TemplateInterpreterGenerator: public AbstractInterpreterGenerator {
void set_safepoints_for_all_bytes();
// Helpers for generate_and_dispatch
address generate_trace_code(TosState state) PRODUCT_RETURN0;
address generate_trace_code(TosState state) PRODUCT_RETURN_NULL;
void count_bytecode() PRODUCT_RETURN;
void histogram_bytecode(Template* t) PRODUCT_RETURN;
void histogram_bytecode_pair(Template* t) PRODUCT_RETURN;

View File

@ -37,6 +37,7 @@
#include "utilities/align.hpp"
#include "utilities/bytes.hpp"
#include "utilities/constantTag.hpp"
#include "utilities/macros.hpp"
#include "utilities/resourceHash.hpp"
// A ConstantPool is an array containing class constants as described in the
@ -781,7 +782,7 @@ private:
int pre_resolve_shared_klasses(TRAPS);
// Debugging
const char* printable_name_at(int cp_index) PRODUCT_RETURN0;
const char* printable_name_at(int cp_index) PRODUCT_RETURN_NULL;
private:

View File

@ -124,11 +124,7 @@ public:
// Raw access function, to allow copying of adr_type efficiently in
// product builds and retain the debug info for debug builds.
const TypePtr *raw_adr_type() const {
#ifdef ASSERT
return _adr_type;
#else
return 0;
#endif
return DEBUG_ONLY(_adr_type) NOT_DEBUG(nullptr);
}
// Return the barrier data of n, if available, or 0 otherwise.

View File

@ -338,6 +338,7 @@
#define NOT_PRODUCT_ARG(arg)
#define PRODUCT_RETURN {}
#define PRODUCT_RETURN0 { return 0; }
#define PRODUCT_RETURN_NULL { return nullptr; }
#define PRODUCT_RETURN_(code) { code }
#else // PRODUCT
#define PRODUCT_ONLY(code)
@ -345,6 +346,7 @@
#define NOT_PRODUCT_ARG(arg) arg,
#define PRODUCT_RETURN /*next token must be ;*/
#define PRODUCT_RETURN0 /*next token must be ;*/
#define PRODUCT_RETURN_NULL /* next token must be ;*/
#define PRODUCT_RETURN_(code) /*next token must be ;*/
#endif // PRODUCT