Remove stray printfs.

SwiftShader shouldn't print anything to stdout in Release builds.

Also refactor UNIMPLEMENTED macro to be able to take a formatted string
with arguments.

Bug b/73656151

Change-Id: Ibadbfba3371324ba1bd608bd51bdac5e5923a20e
Reviewed-on: https://swiftshader-review.googlesource.com/21108
Reviewed-by: Merck Hung <merckhung@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/Common/Configurator.cpp b/src/Common/Configurator.cpp
index 445305c..ead1d28 100644
--- a/src/Common/Configurator.cpp
+++ b/src/Common/Configurator.cpp
@@ -66,7 +66,7 @@
 
 				if(!isprint(line[0]))
 				{
-					printf("Failing on char %d\n", line[0]);
+				//	printf("Failing on char %d\n", line[0]);
 					file.close();
 					return false;
 				}
diff --git a/src/Common/Debug.cpp b/src/Common/Debug.cpp
index c3a1921..acf469e 100644
--- a/src/Common/Debug.cpp
+++ b/src/Common/Debug.cpp
@@ -17,6 +17,8 @@
 #include <stdio.h>
 #include <stdarg.h>
 
+namespace sw
+{
 void trace(const char *format, ...)
 {
 	if(false)
@@ -34,3 +36,4 @@
 		}
 	}
 }
+}
diff --git a/src/Common/Debug.hpp b/src/Common/Debug.hpp
index 436854c..5033bc5 100644
--- a/src/Common/Debug.hpp
+++ b/src/Common/Debug.hpp
@@ -25,25 +25,34 @@
 #undef min
 #undef max
 
+namespace sw
+{
 void trace(const char *format, ...);
+inline void trace() {}
+}
 
 #if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)
-	#define TRACE(format, ...) trace("[0x%0.8X]%s(" format ")\n", this, __FUNCTION__, ##__VA_ARGS__)
+	#define TRACE(format, ...) sw::trace("[0x%0.8X]%s(" format ")\n", this, __FUNCTION__, ##__VA_ARGS__)
 #else
 	#define TRACE(...) ((void)0)
 #endif
 
 #if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)
-	#define UNIMPLEMENTED() {trace("\t! Unimplemented: %s(%d)\n", __FUNCTION__, __LINE__); ASSERT(false);}
+	#define UNIMPLEMENTED(...) do { \
+		sw::trace("\t! Unimplemented: %s(%d): ", __FUNCTION__, __LINE__); \
+		sw::trace(##__VA_ARGS__); \
+		sw::trace("\n"); \
+		ASSERT(false); \
+	} while(0)
 #else
-	#define UNIMPLEMENTED() ((void)0)
+	#define UNIMPLEMENTED(...) ((void)0)
 #endif
 
 #if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)
-	#define ASSERT(expression) {if(!(expression)) trace("\t! Assert failed in %s(%d): " #expression "\n", __FUNCTION__, __LINE__); assert(expression);}
+	#define ASSERT(expression) {if(!(expression)) sw::trace("\t! Assert failed in %s(%d): " #expression "\n", __FUNCTION__, __LINE__); assert(expression);}
 #else
 	#define ASSERT assert
 #endif
 
-#endif   // __ANDROID__
+#endif   // !__ANDROID__
 #endif   // Debug_hpp
diff --git a/src/Common/DebugAndroid.hpp b/src/Common/DebugAndroid.hpp
index 6dfb61d..f5ce468 100644
--- a/src/Common/DebugAndroid.hpp
+++ b/src/Common/DebugAndroid.hpp
@@ -66,7 +66,8 @@
 		AndroidEnterDebugger();											\
 	} while(0)
 
-#define UNIMPLEMENTED() do {						\
+// TODO: Handle __VA_ARGS__ (can be empty)
+#define UNIMPLEMENTED(...) do {						\
 		ALOGE("badness: unimplemented: %s %s:%d",	\
 			  __FUNCTION__, __FILE__, __LINE__);	\
 		AndroidEnterDebugger();						\