Mercurial > hg > index.cgi
comparison lwasm/main.c @ 338:5d401d1eb3e9
Allow disabling debugging messages.
Add test for LWASM_NODEBUG symbol to disable compiling the actual debug
message handling code.
Also, prevent building the debug message arguments if the debug level is not
going to display the message anyway. This comes at the possible expense of
larger code due to wrapping the debug_mesage() function in a macro that
tests the debug level directly. This should prevent calling expensive things
like building a dump of an expression when it is not required.
author | William Astle <lost@l-w.ca> |
---|---|
date | Tue, 05 Aug 2014 22:04:23 -0600 |
parents | 507f442dc71e |
children | 3f8abaac214c |
comparison
equal
deleted
inserted
replaced
337:3b5a45c6ab92 | 338:5d401d1eb3e9 |
---|---|
100 lw_free(as -> output_file); | 100 lw_free(as -> output_file); |
101 as -> output_file = lw_strdup(arg); | 101 as -> output_file = lw_strdup(arg); |
102 break; | 102 break; |
103 | 103 |
104 case 'd': | 104 case 'd': |
105 #ifdef LWASM_NODEBUG | |
106 fprintf(stderr, "This binary has been built without debugging message support\n"); | |
107 #else | |
105 if (!arg) | 108 if (!arg) |
106 as -> debug_level = 50; | 109 as -> debug_level = 50; |
107 else | 110 else |
108 as -> debug_level = atoi(arg); | 111 as -> debug_level = atoi(arg); |
112 #endif | |
109 break; | 113 break; |
110 | 114 |
111 case 'l': | 115 case 'l': |
112 if (as -> list_file) | 116 if (as -> list_file) |
113 lw_free(as -> list_file); | 117 lw_free(as -> list_file); |