Skip to content

Commit

Permalink
8341336: Fix -Wzero-as-null-pointer-constant warnings in PRODUCT-only…
Browse files Browse the repository at this point in the history
… code

Reviewed-by: stefank, iwalulya, shade
  • Loading branch information
Kim Barrett committed Oct 2, 2024
1 parent c43202b commit dc0ce1b
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
5 changes: 3 additions & 2 deletions src/hotspot/share/c1/c1_LIR.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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; }
Expand Down Expand Up @@ -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; }

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion src/hotspot/share/oops/constantPool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -781,7 +782,7 @@ class ConstantPool : public Metadata {
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:

Expand Down
6 changes: 1 addition & 5 deletions src/hotspot/share/opto/memnode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,7 @@ class MemNode : public Node {
// 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.
Expand Down
2 changes: 2 additions & 0 deletions src/hotspot/share/utilities/macros.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,13 +338,15 @@
#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)
#define NOT_PRODUCT(code) code
#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

Expand Down

1 comment on commit dc0ce1b

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.