src/share/demo/jvmti/hprof/hprof_error.h
Print this page
@@ -39,24 +39,29 @@
#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
#define LOG_DUMP_MISC 0x1 /* Misc. logging info */
@@ -75,15 +80,15 @@
#endif
#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)
void error_handler(jboolean fatal, jvmtiError error,
const char *message, const char *file, int line);