diff options
author | ohair <none@none> | 2012-09-11 13:40:59 -0700 |
---|---|---|
committer | ohair <none@none> | 2012-09-11 13:40:59 -0700 |
commit | f9180a90452b5e1d6f387f2127ba6420c022ab32 (patch) | |
tree | d387a42315f9426fc4bfa06c0b68ca9d439d137f /src/share | |
parent | 8f6cf9301c92a82d4238c1f0dfbb985614342b7b (diff) | |
download | jdk8u_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')
-rw-r--r-- | src/share/back/error_messages.h | 13 | ||||
-rw-r--r-- | src/share/back/log_messages.h | 8 | ||||
-rw-r--r-- | src/share/demo/jvmti/hprof/debug_malloc.h | 9 | ||||
-rw-r--r-- | src/share/demo/jvmti/hprof/hprof_error.h | 17 | ||||
-rw-r--r-- | src/share/demo/jvmti/hprof/hprof_util.h | 9 | ||||
-rw-r--r-- | src/share/demo/jvmti/java_crw_demo/java_crw_demo.c | 12 | ||||
-rw-r--r-- | src/share/instrument/JPLISAssert.h | 8 | ||||
-rw-r--r-- | src/share/native/sun/awt/debug/debug_assert.h | 9 | ||||
-rw-r--r-- | src/share/native/sun/awt/debug/debug_mem.c | 7 | ||||
-rw-r--r-- | src/share/native/sun/awt/debug/debug_trace.h | 7 | ||||
-rw-r--r-- | src/share/native/sun/security/pkcs11/wrapper/pkcs11wrapper.h | 9 | ||||
-rw-r--r-- | src/share/npt/utf.h | 7 | ||||
-rw-r--r-- | src/share/transport/shmem/shmemBase.h | 9 |
13 files changed, 95 insertions, 29 deletions
diff --git a/src/share/back/error_messages.h b/src/share/back/error_messages.h index 8e3ae908d9..b886063f04 100644 --- a/src/share/back/error_messages.h +++ b/src/share/back/error_messages.h @@ -42,31 +42,36 @@ const char * jvmtiErrorText(jvmtiError); const char * eventText(int); const char * jdwpErrorText(jdwpError); +/* Use THIS_FILE when it is available. */ +#ifndef THIS_FILE + #define THIS_FILE __FILE__ +#endif + #define EXIT_ERROR(error,msg) \ { \ print_message(stderr, "JDWP exit error ", "\n", \ "%s(%d): %s [%s:%d]", \ jvmtiErrorText((jvmtiError)error), error, (msg==NULL?"":msg), \ - __FILE__, __LINE__); \ + THIS_FILE, __LINE__); \ debugInit_exit((jvmtiError)error, msg); \ } #define JDI_ASSERT(expression) \ do { \ if (gdata && gdata->assertOn && !(expression)) { \ - jdiAssertionFailed(__FILE__, __LINE__, #expression); \ + jdiAssertionFailed(THIS_FILE, __LINE__, #expression); \ } \ } while (0) #define JDI_ASSERT_MSG(expression, msg) \ do { \ if (gdata && gdata->assertOn && !(expression)) { \ - jdiAssertionFailed(__FILE__, __LINE__, msg); \ + jdiAssertionFailed(THIS_FILE, __LINE__, msg); \ } \ } while (0) #define JDI_ASSERT_FAILED(msg) \ - jdiAssertionFailed(__FILE__, __LINE__, msg) + jdiAssertionFailed(THIS_FILE, __LINE__, msg) void do_pause(void); diff --git a/src/share/back/log_messages.h b/src/share/back/log_messages.h index bbab3ba826..507b62a2c0 100644 --- a/src/share/back/log_messages.h +++ b/src/share/back/log_messages.h @@ -33,11 +33,15 @@ void finish_logging(int); #define LOG_NULL ((void)0) -#ifdef JDWP_LOGGING +/* Use THIS_FILE when it is available. */ +#ifndef THIS_FILE + #define THIS_FILE __FILE__ +#endif +#ifdef JDWP_LOGGING #define _LOG(flavor,args) \ - (log_message_begin(flavor,__FILE__,__LINE__), \ + (log_message_begin(flavor,THIS_FILE,__LINE__), \ log_message_end args) #define LOG_TEST(flag) (gdata->log_flags & (flag)) 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) diff --git a/src/share/demo/jvmti/java_crw_demo/java_crw_demo.c b/src/share/demo/jvmti/java_crw_demo/java_crw_demo.c index 1da0e55d32..772548de16 100644 --- a/src/share/demo/jvmti/java_crw_demo/java_crw_demo.c +++ b/src/share/demo/jvmti/java_crw_demo/java_crw_demo.c @@ -70,12 +70,20 @@ /* Macros over error functions to capture line numbers */ -#define CRW_FATAL(ci, message) fatal_error(ci, message, __FILE__, __LINE__) +/* Fatal error used in all builds. */ + +/* Use THIS_FILE when it is available. */ +#ifndef THIS_FILE + #define THIS_FILE "java_crw.demo.c" /* Never use __FILE__ */ +#endif + +#define CRW_FATAL(ci, message) fatal_error(ci, message, THIS_FILE, __LINE__) #if defined(DEBUG) || !defined(NDEBUG) + /* This assert macro is only used in the debug builds. */ #define CRW_ASSERT(ci, cond) \ - ((cond)?(void)0:assert_error(ci, #cond, __FILE__, __LINE__)) + ((cond)?(void)0:assert_error(ci, #cond, THIS_FILE, __LINE__)) #else diff --git a/src/share/instrument/JPLISAssert.h b/src/share/instrument/JPLISAssert.h index c2ef7eef12..a0446447e5 100644 --- a/src/share/instrument/JPLISAssert.h +++ b/src/share/instrument/JPLISAssert.h @@ -49,10 +49,14 @@ extern "C" { #define JPLISASSERT_ENABLEASSERTIONS (0) #endif +/* Use THIS_FILE when it is available. */ +#ifndef THIS_FILE + #define THIS_FILE __FILE__ +#endif #if JPLISASSERT_ENABLEASSERTIONS -#define jplis_assert(x) JPLISAssertCondition((jboolean)(x), #x, __FILE__, __LINE__) -#define jplis_assert_msg(x, msg) JPLISAssertConditionWithMessage((jboolean)(x), #x, msg, __FILE__, __LINE__) +#define jplis_assert(x) JPLISAssertCondition((jboolean)(x), #x, THIS_FILE, __LINE__) +#define jplis_assert_msg(x, msg) JPLISAssertConditionWithMessage((jboolean)(x), #x, msg, THIS_FILE, __LINE__) #else #define jplis_assert(x) #define jplis_assert_msg(x, msg) diff --git a/src/share/native/sun/awt/debug/debug_assert.h b/src/share/native/sun/awt/debug/debug_assert.h index 22d804733e..920f232ee5 100644 --- a/src/share/native/sun/awt/debug/debug_assert.h +++ b/src/share/native/sun/awt/debug/debug_assert.h @@ -32,17 +32,22 @@ extern "C" { #include "debug_util.h" +/* Use THIS_FILE when it is available. */ +#ifndef THIS_FILE + #define THIS_FILE __FILE__ +#endif + #if defined(DEBUG) #define DASSERT(_expr) \ if ( !(_expr) ) { \ - DAssert_Impl( #_expr, __FILE__, __LINE__); \ + DAssert_Impl( #_expr, THIS_FILE, __LINE__); \ } else { \ } #define DASSERTMSG(_expr, _msg) \ if ( !(_expr) ) { \ - DAssert_Impl( (_msg), __FILE__, __LINE__); \ + DAssert_Impl( (_msg), THIS_FILE, __LINE__); \ } else { \ } diff --git a/src/share/native/sun/awt/debug/debug_mem.c b/src/share/native/sun/awt/debug/debug_mem.c index 5a4690be8f..bf91768e6d 100644 --- a/src/share/native/sun/awt/debug/debug_mem.c +++ b/src/share/native/sun/awt/debug/debug_mem.c @@ -27,6 +27,11 @@ #include "debug_util.h" +/* Use THIS_FILE when it is available. */ +#ifndef THIS_FILE + #define THIS_FILE __FILE__ +#endif + #define DMEM_MIN(a,b) (a) < (b) ? (a) : (b) #define DMEM_MAX(a,b) (a) > (b) ? (a) : (b) @@ -291,7 +296,7 @@ void DMem_ReportLeaks() { DMutex_Enter(DMemMutex); /* Force memory leaks to be output regardless of trace settings */ - DTrace_EnableFile(__FILE__, TRUE); + DTrace_EnableFile(THIS_FILE, TRUE); DTRACE_PRINTLN("--------------------------"); DTRACE_PRINTLN("Debug Memory Manager Leaks"); DTRACE_PRINTLN("--------------------------"); diff --git a/src/share/native/sun/awt/debug/debug_trace.h b/src/share/native/sun/awt/debug/debug_trace.h index e91c556ac0..aad4677d11 100644 --- a/src/share/native/sun/awt/debug/debug_trace.h +++ b/src/share/native/sun/awt/debug/debug_trace.h @@ -34,6 +34,11 @@ extern "C" { #include "debug_util.h" +/* Use THIS_FILE when it is available. */ +#ifndef THIS_FILE + #define THIS_FILE __FILE__ +#endif + typedef int dtrace_id; enum { UNDEFINED_TRACE_ID = -1 /* indicates trace point has not been registered yet */ @@ -69,7 +74,7 @@ static dtrace_id _Dt_FileTraceId = UNDEFINED_TRACE_ID; #define _DTrace_Template(_func, _ac, _f, _a1, _a2, _a3, _a4, _a5, _a6, _a7, _a8) \ { \ static dtrace_id _dt_lineid_ = UNDEFINED_TRACE_ID; \ - DTrace_PrintFunction((_func), &_Dt_FileTraceId, &_dt_lineid_, __FILE__, __LINE__, (_ac), (_f), (_a1), (_a2), (_a3), (_a4), (_a5), (_a6), (_a7), (_a8) ); \ + DTrace_PrintFunction((_func), &_Dt_FileTraceId, &_dt_lineid_, THIS_FILE, __LINE__, (_ac), (_f), (_a1), (_a2), (_a3), (_a4), (_a5), (_a6), (_a7), (_a8) ); \ } /* printf style trace macros */ diff --git a/src/share/native/sun/security/pkcs11/wrapper/pkcs11wrapper.h b/src/share/native/sun/security/pkcs11/wrapper/pkcs11wrapper.h index 81e79b9acd..01aeb6fcae 100644 --- a/src/share/native/sun/security/pkcs11/wrapper/pkcs11wrapper.h +++ b/src/share/native/sun/security/pkcs11/wrapper/pkcs11wrapper.h @@ -452,7 +452,12 @@ extern CK_C_INITIALIZE_ARGS_PTR ckpGlobalInitArgs; void *p11malloc(size_t c, char *file, int line); void p11free(void *p, char *file, int line); -#define malloc(c) (p11malloc((c), __FILE__, __LINE__)) -#define free(c) (p11free((c), __FILE__, __LINE__)) +/* Use THIS_FILE when it is available. */ +#ifndef THIS_FILE + #define THIS_FILE __FILE__ +#endif + +#define malloc(c) (p11malloc((c), THIS_FILE, __LINE__)) +#define free(c) (p11free((c), THIS_FILE, __LINE__)) #endif diff --git a/src/share/npt/utf.h b/src/share/npt/utf.h index 8fbda735fa..4345b606df 100644 --- a/src/share/npt/utf.h +++ b/src/share/npt/utf.h @@ -33,8 +33,13 @@ #include "jni.h" #include "utf_md.h" +/* Use THIS_FILE when it is available. */ +#ifndef THIS_FILE + #define THIS_FILE __FILE__ +#endif + /* Error and assert macros */ -#define UTF_ERROR(m) utfError(__FILE__, __LINE__, m) +#define UTF_ERROR(m) utfError(THIS_FILE, __LINE__, m) #define UTF_ASSERT(x) ( (x)==0 ? UTF_ERROR("ASSERT ERROR " #x) : (void)0 ) void utfError(char *file, int line, char *message); diff --git a/src/share/transport/shmem/shmemBase.h b/src/share/transport/shmem/shmemBase.h index 661d9f076b..0d5cec1f7b 100644 --- a/src/share/transport/shmem/shmemBase.h +++ b/src/share/transport/shmem/shmemBase.h @@ -49,11 +49,16 @@ jint shmemBase_receivePacket(SharedMemoryConnection *, jdwpPacket *packet); jint shmemBase_name(SharedMemoryTransport *, char **name); jint shmemBase_getlasterror(char *msg, jint size); +/* Use THIS_FILE when it is available. */ +#ifndef THIS_FILE + #define THIS_FILE __FILE__ +#endif + #ifdef DEBUG #define SHMEM_ASSERT(expression) \ do { \ if (!(expression)) { \ - exitTransportWithError("assertion failed", __FILE__, __DATE__, __LINE__); \ + exitTransportWithError("assertion failed", THIS_FILE, __DATE__, __LINE__); \ } \ } while (0) #else @@ -63,7 +68,7 @@ do { \ #define SHMEM_GUARANTEE(expression) \ do { \ if (!(expression)) { \ - exitTransportWithError("assertion failed", __FILE__, __DATE__, __LINE__); \ + exitTransportWithError("assertion failed", THIS_FILE, __DATE__, __LINE__); \ } \ } while (0) |