update error system
authorPierre-Marc Fournier <pierre-marc.fournier@polymtl.ca>
Tue, 8 Sep 2009 17:55:42 +0000 (13:55 -0400)
committerPierre-Marc Fournier <pierre-marc.fournier@polymtl.ca>
Tue, 8 Sep 2009 17:55:42 +0000 (13:55 -0400)
libust/Makefile.am
libust/localerr.h [deleted file]
share/localerr.h [new file with mode: 0644]
share/usterr.h
ust/Makefile.am
ust/localerr.h [deleted file]
ust/ust.c
ustd/localerr.h [deleted file]

index e3d454194d48da2f6d70f81e112e206dac0ffa57..1f18f8b90adc396f614ff8f442a89e3ba8b0d3eb 100644 (file)
@@ -5,3 +5,4 @@ lib_LTLIBRARIES = libust.la
 libust_la_SOURCES = marker.c marker.h tracepoint.c tracepoint.h immediate.h channels.c channels.h marker-control.c marker-control.h relay.c relay.h tracer.c tracer.h tracercore.c tracercore.h serialize.c tracectl.c $(top_builddir)/libustcomm/ustcomm.c $(top_builddir)/share/usterr.h localerr.h
 libust_la_LDFLAGS = -no-undefined -version-info 0:0:0
 libust_la_LIBADD = $(URCU_LIBS) -lpthread
+libust_la_CFLAGS = -DUST_COMPONENT="libust"
diff --git a/libust/localerr.h b/libust/localerr.h
deleted file mode 100644 (file)
index eef0d4f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include "usterr.h"
diff --git a/share/localerr.h b/share/localerr.h
new file mode 100644 (file)
index 0000000..eef0d4f
--- /dev/null
@@ -0,0 +1 @@
+#include "usterr.h"
index 9c4be7ee7aefff3fb58abb851c4f7e07401845b8..a96a36f2525644456a44608dcf1529f807cfffa1 100644 (file)
@@ -1,15 +1,26 @@
 #ifndef USTERR_H
 #define USTERR_H
 
-//#define DEBUG
+#ifndef UST_COMPONENT
+//#error UST_COMPONENT is undefined
+#define UST_COMPONENT libust
+#endif
+
+/* To stringify the expansion of a define */
+#define XSTR(d) STR(d)
+#define STR(s) #s
+
+#define UST_STR_COMPONENT XSTR(UST_COMPONENT)
+
+#define DEBUG
 #ifdef DEBUG
-# define DBG(fmt, args...) do { fprintf(stderr, fmt "\n", ## args); fflush(stderr); } while(0)
+# define DBG(fmt, args...) do { fprintf(stderr, UST_STR_COMPONENT ": " fmt "(" __FILE__ ":" XSTR(__LINE__) ")\n", ## args); fflush(stderr); } while(0)
 #else
 # define DBG(fmt, args...) do {} while(0)
 #endif
-#define WARN(fmt, args...) fprintf(stderr, "libust: WARNING: " fmt "\n", ## args); fflush(stderr)
-#define ERR(fmt, args...) fprintf(stderr, "libust: ERROR: " fmt "\n", ## args); fflush(stderr)
-#define BUG(fmt, args...) fprintf(stderr, "libust: BUG: " fmt "\n", ## args); fflush(stderr)
+#define WARN(fmt, args...) fprintf(stderr, UST_STR_COMPONENT ": Warning: " fmt "\n", ## args); fflush(stderr)
+#define ERR(fmt, args...) fprintf(stderr, UST_STR_COMPONENT ": Error: " fmt "\n", ## args); fflush(stderr)
+#define BUG(fmt, args...) fprintf(stderr, UST_STR_COMPONENT ": BUG: " fmt "\n", ## args); fflush(stderr)
 #define PERROR(call) perror("ust: ERROR: " call)
 
 #define BUG_ON(condition) do { if (unlikely(condition)) ERR("condition not respected (BUG)"); } while(0)
index e353751eebbfdef89acbb7bdd24e0f91ce7122cd..f6a6e9c410332b8af8bd3caa2a45a9f1ec62273d 100644 (file)
@@ -1,10 +1,8 @@
 bin_PROGRAMS = ust
 ust_SOURCES = ust.c $(top_builddir)/libustcomm/ustcomm.c $(top_builddir)/libustcomm/ustcomm.h $(top_builddir)/libustcmd/ustcmd.c $(top_builddir)/libustcmd/ustcmd.h localerr.h
+ust_CFLAGS = -DUST_COMPONENT=ust
 
-#INCLUDES = -I$(top_builddir)/share
-#INCLUDES += -I@URCU_PATH@
 INCLUDES = $(KCOMPAT_CFLAGS)
-#INCLUDES += -I$(top_builddir)/libust
 INCLUDES += -I$(top_builddir)/libustcomm
 INCLUDES += -I$(top_builddir)/libustcmd
-
+INCLUDES += -I$(top_builddir)/share
diff --git a/ust/localerr.h b/ust/localerr.h
deleted file mode 100644 (file)
index bfb9527..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef LOCALERR_H
-#define LOCALERR_H
-
-#include <stdio.h>
-
-#define DBG(fmt, args...) fprintf(stderr, "ust: " fmt "\n", ## args); fflush(stderr)
-#define WARN(fmt, args...) fprintf(stderr, "ust: WARNING: " fmt "\n", ## args); fflush(stderr)
-#define ERR(fmt, args...) fprintf(stderr, "ust: ERROR: " fmt "\n", ## args); fflush(stderr)
-#define PERROR(a) perror(a)
-
-#endif /* LOCALERR_H */
index d8916653ad1722b00bfec8df45a40e1bc5c8a7d1..53ede09c39d78be21ddfb2f8209bd91415b112e5 100644 (file)
--- a/ust/ust.c
+++ b/ust/ust.c
@@ -25,6 +25,7 @@
 
 #include "ustcomm.h"
 #include "ustcmd.h"
+#include "usterr.h"
 
 enum command {
        START_TRACE,
diff --git a/ustd/localerr.h b/ustd/localerr.h
deleted file mode 100644 (file)
index d4276eb..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <stdio.h>
-
-//#define DEBUG
-#ifdef DEBUG
-# define DBG(fmt, args...) fprintf(stderr, "ustd: " fmt "\n", ## args); fflush(stderr)
-#else
-# define DBG(fmt, args...) do {} while(0)
-#endif
-
-#define WARN(fmt, args...) fprintf(stderr, "ustd: WARNING: " fmt "\n", ## args); fflush(stderr)
-#define ERR(fmt, args...) fprintf(stderr, "ustd: ERROR: " fmt "\n", ## args); fflush(stderr)
-#define PERROR(a) perror(a)
This page took 0.026358 seconds and 4 git commands to generate.