Author: dgorbachev
Date: Fri Dec 13 17:50:49 2013
New Revision: 61265
URL:
http://svn.reactos.org/svn/reactos?rev=61265&view=rev
Log:
[CMAKE][INCLUDE]
- In DPRINT1(), ASSERT(), etc. - print relative (to REACTOS_SOURCE_DIR)
paths to reduce debug log spam.
- Unify GCC and MSVC versions of _WARN() macro.
Added:
trunk/reactos/include/reactos/builddir.h.cmake (with props)
Modified:
trunk/reactos/include/reactos/debug.h
trunk/reactos/include/reactos/version.cmake
Added: trunk/reactos/include/reactos/builddir.h.cmake
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/builddir.h…
==============================================================================
--- trunk/reactos/include/reactos/builddir.h.cmake (added)
+++ trunk/reactos/include/reactos/builddir.h.cmake [iso-8859-1] Fri Dec 13 17:50:49 2013
@@ -0,0 +1,14 @@
+/* Do not edit - Machine generated */
+
+#pragma once
+
+#define REACTOS_SOURCE_DIR "@REACTOS_SOURCE_DIR@"
+#define REACTOS_BINARY_DIR "@REACTOS_BINARY_DIR@"
+
+#if defined(__GNUC__) && defined(__OPTIMIZE__)
+#define __RELFILE__ \
+ (!__builtin_strncmp(__FILE__, REACTOS_SOURCE_DIR, sizeof(REACTOS_SOURCE_DIR) - 1) \
+ ? __FILE__ + sizeof(REACTOS_SOURCE_DIR) : __FILE__)
+#endif
+
+/* EOF */
Propchange: trunk/reactos/include/reactos/builddir.h.cmake
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/reactos/include/reactos/debug.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/debug.h?re…
==============================================================================
--- trunk/reactos/include/reactos/debug.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/debug.h [iso-8859-1] Fri Dec 13 17:50:49 2013
@@ -1,7 +1,7 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
- * FILE: include/internal/debug.h
+ * FILE: include/reactos/debug.h
* PURPOSE: Useful debugging macros
* PROGRAMMERS: David Welch (welch(a)mcmail.com)
* Hermes Belusca-Maito (hermes.belusca(a)sfr.fr)
@@ -12,8 +12,13 @@
* to disable debugging macros.
*/
-#ifndef __INTERNAL_DEBUG
-#define __INTERNAL_DEBUG
+#pragma once
+
+#include <builddir.h>
+
+#if !defined(__RELFILE__)
+#define __RELFILE__ __FILE__
+#endif
/* Define DbgPrint/DbgPrintEx/RtlAssert unless the NDK is used */
#if !defined(_RTLFUNCS_H) && !defined(_NTDDK_)
@@ -63,7 +68,7 @@
#ifndef assert
#if DBG && !defined(NASSERT)
-#define assert(x) if (!(x)) { RtlAssert((PVOID)#x, (PVOID)__FILE__, __LINE__,
""); }
+#define assert(x) if (!(x)) { RtlAssert((PVOID)#x, (PVOID)__RELFILE__, __LINE__,
""); }
#else
#define assert(x) ((VOID) 0)
#endif
@@ -71,7 +76,7 @@
#ifndef ASSERT
#if DBG && !defined(NASSERT)
-#define ASSERT(x) if (!(x)) { RtlAssert((PVOID)#x, (PVOID)__FILE__, __LINE__,
""); }
+#define ASSERT(x) if (!(x)) { RtlAssert((PVOID)#x, (PVOID)__RELFILE__, __LINE__,
""); }
#else
#define ASSERT(x) ((VOID) 0)
#endif
@@ -79,14 +84,14 @@
#ifndef ASSERTMSG
#if DBG && !defined(NASSERT)
-#define ASSERTMSG(m, x) if (!(x)) { RtlAssert((PVOID)#x, __FILE__, __LINE__, m); }
+#define ASSERTMSG(m, x) if (!(x)) { RtlAssert((PVOID)#x, __RELFILE__, __LINE__, m); }
#else
#define ASSERTMSG(m, x) ((VOID) 0)
#endif
#endif
/* For internal purposes only */
-#define __NOTICE(level, fmt, ...) DbgPrint(#level ": %s at %s:%d " fmt,
__FUNCTION__, __FILE__, __LINE__, ##__VA_ARGS__)
+#define __NOTICE(level, fmt, ...) DbgPrint(#level ": %s at %s:%d " fmt,
__FUNCTION__, __RELFILE__, __LINE__, ##__VA_ARGS__)
/* Print stuff only on Debug Builds*/
#define DPFLTR_DEFAULT_ID -1
@@ -94,16 +99,16 @@
/* These are always printed */
#define DPRINT1(fmt, ...) do { \
- if (DbgPrint("(%s:%d) " fmt, __FILE__, __LINE__, ##__VA_ARGS__)) \
- DbgPrint("(%s:%d) DbgPrint() failed!\n", __FILE__, __LINE__); \
+ if (DbgPrint("(%s:%d) " fmt, __RELFILE__, __LINE__, ##__VA_ARGS__)) \
+ DbgPrint("(%s:%d) DbgPrint() failed!\n", __RELFILE__, __LINE__); \
} while (0)
/* These are printed only if NDEBUG is NOT defined */
#ifndef NDEBUG
#define DPRINT(fmt, ...) do { \
- if (DbgPrint("(%s:%d) " fmt, __FILE__, __LINE__, ##__VA_ARGS__))
\
- DbgPrint("(%s:%d) DbgPrint() failed!\n", __FILE__, __LINE__);
\
+ if (DbgPrint("(%s:%d) " fmt, __RELFILE__, __LINE__, ##__VA_ARGS__))
\
+ DbgPrint("(%s:%d) DbgPrint() failed!\n", __RELFILE__,
__LINE__); \
} while (0)
#else
@@ -114,15 +119,15 @@
#define UNIMPLEMENTED __NOTICE(WARNING, "is UNIMPLEMENTED!\n");
- #define ERR_(ch, fmt, ...) DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_ERROR_LEVEL,
"(%s:%d) " fmt, __FILE__, __LINE__, ##__VA_ARGS__)
- #define WARN_(ch, fmt, ...) DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_WARNING_LEVEL,
"(%s:%d) " fmt, __FILE__, __LINE__, ##__VA_ARGS__)
- #define TRACE_(ch, fmt, ...) DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_TRACE_LEVEL,
"(%s:%d) " fmt, __FILE__, __LINE__, ##__VA_ARGS__)
- #define INFO_(ch, fmt, ...) DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_INFO_LEVEL,
"(%s:%d) " fmt, __FILE__, __LINE__, ##__VA_ARGS__)
-
- #define ERR__(ch, fmt, ...) DbgPrintEx(ch, DPFLTR_ERROR_LEVEL, "(%s:%d)
" fmt, __FILE__, __LINE__, ##__VA_ARGS__)
- #define WARN__(ch, fmt, ...) DbgPrintEx(ch, DPFLTR_WARNING_LEVEL, "(%s:%d)
" fmt, __FILE__, __LINE__, ##__VA_ARGS__)
- #define TRACE__(ch, fmt, ...) DbgPrintEx(ch, DPFLTR_TRACE_LEVEL, "(%s:%d)
" fmt, __FILE__, __LINE__, ##__VA_ARGS__)
- #define INFO__(ch, fmt, ...) DbgPrintEx(ch, DPFLTR_INFO_LEVEL, "(%s:%d) "
fmt, __FILE__, __LINE__, ##__VA_ARGS__)
+ #define ERR_(ch, fmt, ...) DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_ERROR_LEVEL,
"(%s:%d) " fmt, __RELFILE__, __LINE__, ##__VA_ARGS__)
+ #define WARN_(ch, fmt, ...) DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_WARNING_LEVEL,
"(%s:%d) " fmt, __RELFILE__, __LINE__, ##__VA_ARGS__)
+ #define TRACE_(ch, fmt, ...) DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_TRACE_LEVEL,
"(%s:%d) " fmt, __RELFILE__, __LINE__, ##__VA_ARGS__)
+ #define INFO_(ch, fmt, ...) DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_INFO_LEVEL,
"(%s:%d) " fmt, __RELFILE__, __LINE__, ##__VA_ARGS__)
+
+ #define ERR__(ch, fmt, ...) DbgPrintEx(ch, DPFLTR_ERROR_LEVEL, "(%s:%d)
" fmt, __RELFILE__, __LINE__, ##__VA_ARGS__)
+ #define WARN__(ch, fmt, ...) DbgPrintEx(ch, DPFLTR_WARNING_LEVEL, "(%s:%d)
" fmt, __RELFILE__, __LINE__, ##__VA_ARGS__)
+ #define TRACE__(ch, fmt, ...) DbgPrintEx(ch, DPFLTR_TRACE_LEVEL, "(%s:%d)
" fmt, __RELFILE__, __LINE__, ##__VA_ARGS__)
+ #define INFO__(ch, fmt, ...) DbgPrintEx(ch, DPFLTR_INFO_LEVEL, "(%s:%d) "
fmt, __RELFILE__, __LINE__, ##__VA_ARGS__)
#else /* not DBG */
@@ -234,14 +239,10 @@
#define __STRING__(x) __STRING2__(x)
#define __STRLINE__ __STRING__(__LINE__)
-#define __TOKENPASTE2__(x, y) x ## y
-#define __TOKENPASTE__(x, y) __TOKENPASTE2__(x, y)
-
-#ifdef _MSC_VER
+#if !defined(_MSC_VER) && !defined(__pragma)
+#define __pragma(x) _Pragma(#x)
+#endif
+
#define _WARN(msg) __pragma(message("WARNING! Line " __STRLINE__ ": "
msg))
-#else
-#define _WARN1(_func1, _func2, _msg) void __attribute__((warning (_msg))) _func1(void);
void __attribute__((used)) _func2(void) { _func1(); }
-#define _WARN(_msg) _WARN1(__TOKENPASTE__(__warn_func1__, __LINE__),
__TOKENPASTE__(__warn_func2__, __LINE__), _msg)
-#endif
-
-#endif /* __INTERNAL_DEBUG */
+
+/* EOF */
Modified: trunk/reactos/include/reactos/version.cmake
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/version.cm…
==============================================================================
--- trunk/reactos/include/reactos/version.cmake [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/version.cmake [iso-8859-1] Fri Dec 13 17:50:49 2013
@@ -65,3 +65,4 @@
configure_file(include/reactos/version.h.cmake
${REACTOS_BINARY_DIR}/include/reactos/version.h)
configure_file(include/reactos/buildno.h.cmake
${REACTOS_BINARY_DIR}/include/reactos/buildno.h)
+configure_file(include/reactos/builddir.h.cmake
${REACTOS_BINARY_DIR}/include/reactos/builddir.h)