aboutsummaryrefslogtreecommitdiff
path: root/src/share/demo/jvmti/hprof
diff options
context:
space:
mode:
authorohair <none@none>2012-09-11 13:40:59 -0700
committerohair <none@none>2012-09-11 13:40:59 -0700
commitf9180a90452b5e1d6f387f2127ba6420c022ab32 (patch)
treed387a42315f9426fc4bfa06c0b68ca9d439d137f /src/share/demo/jvmti/hprof
parent8f6cf9301c92a82d4238c1f0dfbb985614342b7b (diff)
downloadjdk8u_jdk-f9180a90452b5e1d6f387f2127ba6420c022ab32.tar.gz
7197771: Adjust jdk sources to avoid use of implementation defined value of __FILE__
7180608: Sort the order of object files when building shared libraries Reviewed-by: ohrstrom, erikj, tbell
Diffstat (limited to 'src/share/demo/jvmti/hprof')
-rw-r--r--src/share/demo/jvmti/hprof/debug_malloc.h9
-rw-r--r--src/share/demo/jvmti/hprof/hprof_error.h17
-rw-r--r--src/share/demo/jvmti/hprof/hprof_util.h9
3 files changed, 25 insertions, 10 deletions
diff --git a/src/share/demo/jvmti/hprof/debug_malloc.h b/src/share/demo/jvmti/hprof/debug_malloc.h
index 6b6b4c6b73..d74ff608b2 100644
--- a/src/share/demo/jvmti/hprof/debug_malloc.h
+++ b/src/share/demo/jvmti/hprof/debug_malloc.h
@@ -59,6 +59,11 @@
#include <stdlib.h>
#include <string.h>
+/* Use THIS_FILE when it is available. */
+#ifndef THIS_FILE
+ #define THIS_FILE __FILE__
+#endif
+
/* The real functions behind the macro curtains. */
void *debug_malloc(size_t, const char *, int);
@@ -71,10 +76,10 @@ void debug_free(void *, const char *, int);
void debug_malloc_verify(const char*, int);
#undef malloc_verify
-#define malloc_verify() debug_malloc_verify(__FILE__, __LINE__)
+#define malloc_verify() debug_malloc_verify(THIS_FILE, __LINE__)
void debug_malloc_police(const char*, int);
#undef malloc_police
-#define malloc_police() debug_malloc_police(__FILE__, __LINE__)
+#define malloc_police() debug_malloc_police(THIS_FILE, __LINE__)
#endif
diff --git a/src/share/demo/jvmti/hprof/hprof_error.h b/src/share/demo/jvmti/hprof/hprof_error.h
index c0d6aed0fe..b82d4ee6b9 100644
--- a/src/share/demo/jvmti/hprof/hprof_error.h
+++ b/src/share/demo/jvmti/hprof/hprof_error.h
@@ -41,20 +41,25 @@
#ifndef HPROF_ERROR_H
#define HPROF_ERROR_H
+/* Use THIS_FILE when it is available. */
+#ifndef THIS_FILE
+ #define THIS_FILE __FILE__
+#endif
+
/* Macros over assert and error functions so we can capture the source loc. */
#define HPROF_BOOL(x) ((jboolean)((x)==0?JNI_FALSE:JNI_TRUE))
#define HPROF_ERROR(fatal,msg) \
- error_handler(HPROF_BOOL(fatal), JVMTI_ERROR_NONE, msg, __FILE__, __LINE__)
+ error_handler(HPROF_BOOL(fatal), JVMTI_ERROR_NONE, msg, THIS_FILE, __LINE__)
#define HPROF_JVMTI_ERROR(error,msg) \
error_handler(HPROF_BOOL(error!=JVMTI_ERROR_NONE), \
- error, msg, __FILE__, __LINE__)
+ error, msg, THIS_FILE, __LINE__)
#if defined(DEBUG) || !defined(NDEBUG)
#define HPROF_ASSERT(cond) \
- (((int)(cond))?(void)0:error_assert(#cond, __FILE__, __LINE__))
+ (((int)(cond))?(void)0:error_assert(#cond, THIS_FILE, __LINE__))
#else
#define HPROF_ASSERT(cond)
#endif
@@ -77,11 +82,11 @@
#define LOG_FORMAT(format) "HPROF LOG: " format " [%s:%d]\n"
#define LOG1(str1) LOG_STDERR((stderr, LOG_FORMAT("%s"), \
- str1, __FILE__, __LINE__ ))
+ str1, THIS_FILE, __LINE__ ))
#define LOG2(str1,str2) LOG_STDERR((stderr, LOG_FORMAT("%s %s"), \
- str1, str2, __FILE__, __LINE__ ))
+ str1, str2, THIS_FILE, __LINE__ ))
#define LOG3(str1,str2,num) LOG_STDERR((stderr, LOG_FORMAT("%s %s 0x%x"), \
- str1, str2, num, __FILE__, __LINE__ ))
+ str1, str2, num, THIS_FILE, __LINE__ ))
#define LOG(str) LOG1(str)
diff --git a/src/share/demo/jvmti/hprof/hprof_util.h b/src/share/demo/jvmti/hprof/hprof_util.h
index c052394f2b..588570ce64 100644
--- a/src/share/demo/jvmti/hprof/hprof_util.h
+++ b/src/share/demo/jvmti/hprof/hprof_util.h
@@ -41,6 +41,11 @@
#ifndef HPROF_UTIL_H
#define HPROF_UTIL_H
+/* Use THIS_FILE when it is available. */
+#ifndef THIS_FILE
+ #define THIS_FILE __FILE__
+#endif
+
/* Macros that protect code from accidently using a local ref improperly */
#define WITH_LOCAL_REFS(env, number) \
{ \
@@ -184,8 +189,8 @@ void hprof_free(void *ptr);
#ifdef DEBUG
void * hprof_debug_malloc(int size, char *file, int line);
void hprof_debug_free(void *ptr, char *file, int line);
- #define HPROF_MALLOC(size) hprof_debug_malloc(size, __FILE__, __LINE__)
- #define HPROF_FREE(ptr) hprof_debug_free(ptr, __FILE__, __LINE__)
+ #define HPROF_MALLOC(size) hprof_debug_malloc(size, THIS_FILE, __LINE__)
+ #define HPROF_FREE(ptr) hprof_debug_free(ptr, THIS_FILE, __LINE__)
#else
#define HPROF_MALLOC(size) hprof_malloc(size)
#define HPROF_FREE(ptr) hprof_free(ptr)