lib: Expose SOURCE_LOCATOR as OVS_SOURCE_LOACATOR
[cascardo/ovs.git] / include / openvswitch / util.h
index b2b20a5..b0b9935 100644 (file)
@@ -32,6 +32,14 @@ void ovs_set_program_name__(const char *name, const char *version,
 const char *ovs_get_program_name(void);
 const char *ovs_get_program_version(void);
 
+/* Expands to a string that looks like "<file>:<line>", e.g. "tmp.c:10".
+ *
+ * See http://c-faq.com/ansi/stringize.html for an explanation of OVS_STRINGIZE
+ * and OVS_STRINGIZE2. */
+#define OVS_SOURCE_LOCATOR __FILE__ ":" OVS_STRINGIZE(__LINE__)
+#define OVS_STRINGIZE(ARG) OVS_STRINGIZE2(ARG)
+#define OVS_STRINGIZE2(ARG) #ARG
+
 #ifdef __cplusplus
 }
 #endif