Browse Source

libc: change some math debugging

K. Lange 4 years ago
parent
commit
b73316b5f5
2 changed files with 7 additions and 2 deletions
  1. 2 1
      libc/math/bad.c
  2. 5 1
      libc/math/math.c

+ 2 - 1
libc/math/bad.c

@@ -2,7 +2,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#define BAD do { if (getenv("LIBM_DEBUG")) { fprintf(stderr, "Called bad math function %s\n", __func__); } } while (0)
+extern char * _argv_0;
+#define BAD do { if (getenv("LIBM_DEBUG")) { fprintf(stderr, "%s called bad math function %s\n", _argv_0, __func__); } } while (0)
 
 double acos(double x) {
 	BAD;

+ 5 - 1
libc/math/math.c

@@ -3,8 +3,12 @@
 #include <string.h>
 #include <stdio.h>
 
-//#define MATH do { fprintf(stderr, "Executed math function %s\n", __func__); } while (0)
+#if 0
+extern char * _argv_0;
+#define MATH do { if (getenv("LIBM_DEBUG")) { fprintf(stderr, "%s called math function %s\n", _argv_0, __func__); } } while (0)
+#else
 #define MATH (void)0
+#endif
 
 double exp(double x) {
 	return pow(2.71828182846, x);