From: Mazet Laurent Date: Tue, 8 Apr 2025 22:58:35 +0000 (+0200) Subject: add a compilation flag to remove file location on verbose messages X-Git-Tag: v1.0~42 X-Git-Url: https://secure.softndesign.org/git/?a=commitdiff_plain;h=94431d4539fa391a0b9ab7cfdcca4221c7010316;p=morep.git add a compilation flag to remove file location on verbose messages --- diff --git a/makefile b/makefile index b9784bf..0233737 100644 --- a/makefile +++ b/makefile @@ -4,6 +4,7 @@ CC = gcc #INCLUDES = -I../debug -D__MEMORY_ALLOCATION__ INCLUDES += -DVERBOSE_COLOR=1 +#INCLUDES += -DVERBOSE_LOCATION=1 OFLAGS = -O4 -Os #OFLAGS = -O0 #OFLAGS = -O4 -ffast-math -finline-functions diff --git a/verbose.h b/verbose.h index 3eddc94..09daadf 100644 --- a/verbose.h +++ b/verbose.h @@ -23,6 +23,9 @@ __BEGIN_DECLS #ifndef VERBOSE_COLOR #define VERBOSE_COLOR 0 #endif +#ifndef VERBOSE_LOCATION +#define VERBOSE_LOCATION 0 +#endif /** Debug level @@ -99,11 +102,12 @@ __BEGIN_DECLS @param format format string @param ... optionnal arguments */ -#define PRINTF(format...) \ - do { \ - printf ("%s+%d[%s]: ", __FILE__, __LINE__, _level); \ - printf (format); \ - fflush (stdout); \ +#define PRINTF(format...) \ + do { \ + if (VERBOSE_LOCATION) printf ("%s+%d ", __FILE__, __LINE__); \ + printf ("[%s] ", _level); \ + printf (format); \ + fflush (stdout); \ } while (0) @@ -114,11 +118,12 @@ __BEGIN_DECLS @param format format string @param ... optionnal arguments */ -#define FPRINTF(stream, format...) \ - do { \ - fprintf (stream,"%s+%d[%s]: ", __FILE__, __LINE__, _level); \ - fprintf (stream, format); \ - fflush (stream); \ +#define FPRINTF(stream, format...) \ + do { \ + if (VERBOSE_LOCATION) fprintf (stream, "%s+%d ", __FILE__, __LINE__); \ + fprintf (stream, "[%s] ", _level); \ + fprintf (stream, format); \ + fflush (stream); \ } while (0) __END_DECLS