Skip to content

Commit 7e11fb7

Browse files
author
Kim Barrett
committed
8335688: Fix -Wzero-as-null-pointer-constant warnings from fflush calls in jvmti tests
Reviewed-by: jwaters, coleenp
1 parent 531a6d8 commit 7e11fb7

File tree

25 files changed

+175
-175
lines changed

25 files changed

+175
-175
lines changed

test/hotspot/jtreg/serviceability/jvmti/AddModuleUsesAndProvides/libAddModuleUsesAndProvidesTest.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -200,7 +200,7 @@ Java_MyPackage_AddModuleUsesAndProvidesTest_checkUses(JNIEnv *env,
200200
throw_exc(env, "Check #UC3: service can not be used unexpectedly");
201201
return FAILED;
202202
}
203-
fflush(0);
203+
fflush(NULL);
204204
return PASSED;
205205
}
206206

@@ -275,7 +275,7 @@ Java_MyPackage_AddModuleUsesAndProvidesTest_checkProvides(JNIEnv *env,
275275
throw_exc(env, "Check #PC2: error in add provides to baseModule with correct service and serviceImpl");
276276
return FAILED;
277277
}
278-
fflush(0);
278+
fflush(NULL);
279279
return PASSED;
280280
}
281281

test/hotspot/jtreg/serviceability/jvmti/GenerateEvents/libGenerateEvents1.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ CompiledMethodLoad(jvmtiEnv* jvmti, jmethodID method,
7171
check_jvmti_status(env, err, "CompiledMethodLoad: Error in JVMTI GetMethodName");
7272

7373
printf("%s: CompiledMethodLoad: %s%s\n", AGENT_NAME, name, sign);
74-
fflush(0);
74+
fflush(nullptr);
7575
}
7676

7777
JNIEXPORT jint JNICALL

test/hotspot/jtreg/serviceability/jvmti/GenerateEvents/libGenerateEvents2.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ CompiledMethodLoad(jvmtiEnv* jvmti, jmethodID method,
7171
check_jvmti_status(env, err, "CompiledMethodLoad: Error in JVMTI GetMethodName");
7272

7373
printf("%s: CompiledMethodLoad: %s%s\n", AGENT_NAME, name, sign);
74-
fflush(0);
74+
fflush(nullptr);
7575
}
7676

7777
JNIEXPORT jint JNICALL
@@ -132,7 +132,7 @@ Java_MyPackage_GenerateEventsTest_agent2FailStatus(JNIEnv *env, jclass cls) {
132132
printf("check2: Unexpected non-zero event count in agent2: %d\n", agent2_event_count);
133133
}
134134
printf("\n");
135-
fflush(0);
135+
fflush(nullptr);
136136

137137
return fail_status;
138138
}

test/hotspot/jtreg/serviceability/jvmti/GetClassFields/FilteredFields/libFilteredFieldsTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
3535
jint res = jvm->GetEnv((void **)&jvmti, JVMTI_VERSION_1_1);
3636
if (res != JNI_OK || jvmti == nullptr) {
3737
printf("Wrong result of a valid call to GetEnv!\n");
38-
fflush(0);
38+
fflush(nullptr);
3939
return JNI_ERR;
4040
}
4141
return JNI_OK;
@@ -72,7 +72,7 @@ Java_FilteredFieldsTest_getJVMTIFieldCount(JNIEnv *env, jclass cls, jclass clazz
7272
printf(" [%d]: %s\n", i, name);
7373
jvmti->Deallocate((unsigned char *)name);
7474
}
75-
fflush(0);
75+
fflush(nullptr);
7676
return fcount;
7777
}
7878

test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/MissedStackMapFrames/libMissedStackMapFrames.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ static void _log(const char* format, ...) {
3131
va_start(args, format);
3232
vprintf(format, args);
3333
va_end(args);
34-
fflush(0);
34+
fflush(nullptr);
3535
}
3636

3737
static jvmtiEnv* jvmti = nullptr;

test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/RedefineRetransform/libRedefineRetransform.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ static void _log(const char* format, ...) {
3636
va_start(args, format);
3737
vprintf(format, args);
3838
va_end(args);
39-
fflush(0);
39+
fflush(nullptr);
4040
}
4141

4242
static bool isTestClass(const char* name) {

test/hotspot/jtreg/serviceability/jvmti/events/FramePop/framepop02/libframepop02.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ void JNICALL MethodEntry(jvmtiEnv *jvmti, JNIEnv *jni,
194194
{
195195
if (printdump == JNI_TRUE) {
196196
print_current_time();
197-
fflush(0);
197+
fflush(nullptr);
198198
LOG(">>> %sMethod entry\n>>>", (isNative == JNI_TRUE) ? "Native " : "");
199199
printInfo(jni, jvmti, thr, method, frameCount);
200200
}
@@ -231,7 +231,7 @@ void JNICALL FramePop(jvmtiEnv *jvmti, JNIEnv *jni,
231231
{
232232
if (printdump == JNI_TRUE) {
233233
print_current_time();
234-
fflush(0);
234+
fflush(nullptr);
235235
LOG(" >>> Frame Pop\n>>>");
236236
printInfo(jni, jvmti, thr, method, frameCount);
237237
}

test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/get_stack_trace.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ int compare_stack_trace(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread,
7070

7171
int exp_idx = expected_frames_length - 1 - i;
7272
printf("expected idx %d\n", exp_idx);
73-
fflush(0);
73+
fflush(nullptr);
7474
if (i < expected_frames_length) {
7575

7676
// for generated classes don't compare lambda indicies

test/hotspot/jtreg/serviceability/jvmti/vthread/SuspendResume1/libSuspendResume1.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ check_suspended_state(JNIEnv* jni, jthread thread, int thr_idx, char* tname, con
138138

139139
LOG("## Agent: %s: virtual thread of carrier thread has state: %s (%d)\n",
140140
func_name, TranslateState(state), (int)state);
141-
fflush(0);
141+
fflush(nullptr);
142142
}
143143
set_agent_fail_status();
144144
fatal(jni, "check_resumed_state: expected SUSPENDED flag in thread state");
@@ -169,7 +169,7 @@ check_resumed_state(JNIEnv* jni, jthread thread, int thr_idx, char* tname, const
169169

170170
LOG("## Agent: %s: virtual thread of carrier thread has state: %s (%d)\n",
171171
func_name, TranslateState(state), (int)state);
172-
fflush(0);
172+
fflush(nullptr);
173173
}
174174
set_agent_fail_status();
175175
fatal(jni, "check_resumed_state: NOT expected SUSPENDED flag in thread state");
@@ -210,7 +210,7 @@ test_thread_resume(JNIEnv* jni, jthread thread, int thr_idx, char* tname) {
210210

211211
LOG("## Agent: test_thread_resume: virtual thread of carrier thread has state: %s (%d)\n",
212212
TranslateState(state), (int)state);
213-
fflush(0);
213+
fflush(nullptr);
214214
}
215215
check_jvmti_status(jni, err, "test_thread_resume: error in JVMTI ResumeThread");
216216

test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassFields/getclfld007/getclfld007.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ Java_nsk_jvmti_GetClassFields_getclfld007_check(JNIEnv *env, jclass cls, jclass
8686

8787
if (jvmti == nullptr) {
8888
printf("JVMTI client was not properly loaded!\n");
89-
fflush(0);
89+
fflush(nullptr);
9090
result = STATUS_FAILED;
9191
return;
9292
}
@@ -98,7 +98,7 @@ Java_nsk_jvmti_GetClassFields_getclfld007_check(JNIEnv *env, jclass cls, jclass
9898
if (err != JVMTI_ERROR_NONE) {
9999
printf("GetClassFields unexpected error: %s (%d)\n",
100100
TranslateError(err), err);
101-
fflush(0);
101+
fflush(nullptr);
102102
result = STATUS_FAILED;
103103
return;
104104
}
@@ -132,7 +132,7 @@ Java_nsk_jvmti_GetClassFields_getclfld007_check(JNIEnv *env, jclass cls, jclass
132132
jvmti->Deallocate((unsigned char *)name);
133133
jvmti->Deallocate((unsigned char *)sig);
134134
}
135-
fflush(0);
135+
fflush(nullptr);
136136
}
137137

138138
JNIEXPORT int JNICALL

0 commit comments

Comments
 (0)