Commit cfd0d8a0 authored by Alessandro Rubini's avatar Alessandro Rubini

diag: kill PPSI_NO_DIAG and diag-no

Really, this is an extrac complexity with no advantage (did we ever
use it?)  If users really want a small system they can choose the NONE
implementation of pp_printf.  The extra half a kilobyte saved by diag-no
is really not worth the effort:

% make clean; make -s ARCH=bare-i386 CONFIG_PRINTF_NONE=y
% size ppsi.o
   text    data     bss     dec     hex filename
  10323     208     264   10795    2a2b ppsi.o

% make clean; make -s ARCH=bare-i386 CONFIG_PRINTF_NONE=y PPSI_NO_DIAG=y
% size ppsi.o
   text    data     bss     dec     hex filename
   9792     208     264   10264    2818 ppsi.o
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent b5b16b95
# Alessandro Rubini for CERN, 2011 -- public domain # Alessandro Rubini for CERN, 2011 -- public domain
# This changed in 2013-02, and it's incompatible with what we had # This changed in 2013-02, and it's incompatible with what we had
ifdef PPSI_NO_DIAG
OBJ-y += diag/diag-no.o
else
OBJ-y += diag/diag-yes.o
endif
ifdef HAS_DIAG ifdef HAS_DIAG
SAY := $(shell echo "WARNING: ppsi doesn't use \$$HAS_DIAG any more" >&2) SAY := $(shell echo "WARNING: ppsi doesn't use \$$HAS_DIAG any more" >&2)
endif endif
......
/*
* Alessandro Rubini for CERN, 2011 -- public domain
*/
#include <ppsi/ppsi.h>
/*
* Having no diagnostics, just make one function that returns 0 and alias
* all the rest to it (those returning void will have the caller ignore our 0)
*/
int pp_diag_nop(void)
{
return 0;
}
void pp_diag_fsm(struct pp_instance *ppi, int sequence, int plen)
__attribute__((weak,alias("pp_diag_nop")));
void pp_diag_trace(struct pp_instance *ppi, const char *f, int line)
__attribute__((weak,alias("pp_diag_nop")));
void pp_diag_error(struct pp_instance *ppi, int err)
__attribute__((weak,alias("pp_diag_nop")));
void pp_diag_error_str2(struct pp_instance *ppi, char *s1, char *s2)
__attribute__((weak,alias("pp_diag_nop")));
void pp_diag_fatal(struct pp_instance *ppi, char *s1, char *s2)
__attribute__((weak,alias("pp_diag_nop")));
void pp_diag_printf(struct pp_instance *ppi, char *fmt, ...)
__attribute__((weak,alias("pp_diag_nop")));
void pp_timed_printf(char *fmt, ...)
__attribute__((weak,alias("pp_diag_nop")));
int pp_printf(const char *fmt, ...)
__attribute__((weak,alias("pp_diag_nop")));
int pp_vprintf(const char *fmt, va_list args)
__attribute__((weak,alias("pp_diag_nop")));
...@@ -66,7 +66,6 @@ environment: ...@@ -66,7 +66,6 @@ environment:
CROSS_COMPILE prefix, like "arm-linux-", or empty CROSS_COMPILE prefix, like "arm-linux-", or empty
PROTO_EXT "whiterabbit" or empty PROTO_EXT "whiterabbit" or empty
ARCH name of you arch (default: gnu-linux) ARCH name of you arch (default: gnu-linux)
PPSI_NO_DIAG if set, prevents diagnostics from being there
If none of the variables are specified, the default Makefile compiles If none of the variables are specified, the default Makefile compiles
with standard gcc, over gnu-linux architecture, with no protocol with standard gcc, over gnu-linux architecture, with no protocol
......
...@@ -2,9 +2,6 @@ ...@@ -2,9 +2,6 @@
* Macros for diagnostic prints. The thing is not trivial because * Macros for diagnostic prints. The thing is not trivial because
* we need to remove all strings and parameter passing when running * we need to remove all strings and parameter passing when running
* wrpc-sw with all its options enabled, for space reasons. * wrpc-sw with all its options enabled, for space reasons.
*
* Note that by building with PPSI_NO_DIAG (see diag/Makefile) no message
* at all is there (and it can save quite some binary space).
*/ */
/* /*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment