From 04a01c63da3f9afc08b71c863127299e2d22462f Mon Sep 17 00:00:00 2001 From: Patrick Williams Date: Tue, 16 Aug 2011 17:35:23 -0500 Subject: Errl parser fixes. - Rexx script fails on newer Linux. - Compiler warnings on newer GCC due to const char vs char. - Add .gitignore file for usr/errl/parser/bin directory. Change-Id: I4c86fef91d68e2dd909b72b8802173c76ecd9da4 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/261 Tested-by: Jenkins Server Reviewed-by: Monte K. Copeland --- src/usr/errl/parser/.gitignore | 1 + src/usr/errl/parser/errlparser.C | 10 +++---- src/usr/errl/parser/makefile | 20 ++++++++------ src/usr/errl/parser/readcomps.rex | 58 --------------------------------------- 4 files changed, 17 insertions(+), 72 deletions(-) create mode 100644 src/usr/errl/parser/.gitignore delete mode 100644 src/usr/errl/parser/readcomps.rex (limited to 'src') diff --git a/src/usr/errl/parser/.gitignore b/src/usr/errl/parser/.gitignore new file mode 100644 index 000000000..36f971e32 --- /dev/null +++ b/src/usr/errl/parser/.gitignore @@ -0,0 +1 @@ +bin/* diff --git a/src/usr/errl/parser/errlparser.C b/src/usr/errl/parser/errlparser.C index 739e65558..037eeb03f 100644 --- a/src/usr/errl/parser/errlparser.C +++ b/src/usr/errl/parser/errlparser.C @@ -40,7 +40,7 @@ Contact: Monte Copeland\n\ // this program will be spawned from traceHB.py, I think we're better // served sending the error message to stdout, not stderr. I don't // think Simics is piping stderr to its console. -void halt( char * msg ) +void halt( const char * msg ) { fprintf( stdout, "%s", msg ); @@ -57,7 +57,7 @@ void halt( char * msg ) // that maps comp id to a string label for it. struct _errlcompname { - char * pszName; + const char * pszName; uint32_t value; }; typedef _errlcompname ERRLCOMPNAME_t; @@ -73,9 +73,9 @@ ERRLCOMPNAME_t g_errlcompnames[] = { // it, return a char* to the component name. Return // null if not found, which printf seems to handle // OK by printing (null). -char * FindComp( uint16_t reasoncode ) +const char * FindComp( uint16_t reasoncode ) { - char * pch = NULL; + const char * pch = NULL; uint32_t id = (reasoncode & 0xFF00 ); int c = sizeof( g_errlcompnames ) / sizeof( g_errlcompnames[0] ); for( int i = 0; i < c; i++ ) @@ -336,7 +336,7 @@ char* ReadStorageBuffer(char* i_Image, uint32_t i_ulAddr, uint32_t &io_cbBuffer) //---------------------------------------------------------------------------- // Open the given symbols file name, a text file, and find the storage address // of error logs given by the symbol in pszSearch. -uint32_t FindSymbol( char * pszSymbolFile, char * pszSearch ) +uint32_t FindSymbol( char * pszSymbolFile, const char * pszSearch ) { char * pszAddr = NULL; char * pch; diff --git a/src/usr/errl/parser/makefile b/src/usr/errl/parser/makefile index f0d8e180b..2a5b44417 100644 --- a/src/usr/errl/parser/makefile +++ b/src/usr/errl/parser/makefile @@ -13,23 +13,25 @@ all: code_pass gen_pass: -code_pass: bindir $(BIN)/errlparser +code_pass: $(BIN)/errlparser clean: rm -fr $(BIN) beam: -bindir: - mkdir -p $(BIN) +$(BIN)/comps.C: $(ROOTPATH)/src/include/usr/hbotcompid.H + mkdir -p $(BIN) + grep "const compId_t [A-Z0-9]*_COMP_ID" $^ | \ + grep -v MY_COMP_ID | \ + sed 's/const compId_t \([A-Z0-9]*\)_COMP_ID[ =\t]*\(0[xX][0-0a-fA-F]*\).*/{ "\1", \2 },/' \ + > $@ -$(BIN)/comps.C: $(ROOTPATH)/src/include/usr/hbotcompid.H readcomps.rex - rexx readcomps.rex $(ROOTPATH)/src/include/usr/hbotcompid.H >$(BIN)/comps.C - -$(BIN)/errlparser.o: errlparser.C $(ROOTPATH)/src/include/usr/errl/errltypes.H $(BIN)/comps.C - $(CC) -c $(CFLAGS) -I bin -o $(BIN)/errlparser.o errlparser.C +$(BIN)/errlparser.o: errlparser.C $(ROOTPATH)/src/include/usr/errl/errltypes.H $(BIN)/comps.C + mkdir -p $(BIN) + $(CC) -c $(CFLAGS) -I bin -o $@ $< $(BIN)/errlparser: $(BIN)/errlparser.o - $(CC) -o $(BIN)/errlparser $(BIN)/errlparser.o + $(CC) -o $@ $< diff --git a/src/usr/errl/parser/readcomps.rex b/src/usr/errl/parser/readcomps.rex deleted file mode 100644 index 9aad554d8..000000000 --- a/src/usr/errl/parser/readcomps.rex +++ /dev/null @@ -1,58 +0,0 @@ -/* - * @file readcomps.rex - * - * Input file name is expected to be hbotcompid.H - * Output to stdout a snippet of C code that can - * be included by errlparser.C - */ - -parse arg szInput . - -if length( szInput ) = 0 then do - say 'Give filename on command line.' - signal halt -end - -szRC = stream( szInput, 'C', 'OPEN READ' ) -if left( szRC, 5 ) <> 'READY' then do - say 'File' szInput 'not found.' - signal halt -end - -do while lines( szInput ) - szCompName = '' - szCompID = '' - - szLine = linein( szInput ) - p1 = pos( "compId_t", szLine ); - p2 = pos( "_COMP_ID", szLine ); - p3 = pos( "MY_COMP_", szLine ); - if p1 > 0 & p2 > p1 & p3=0 then do - - /* interesting COMP_ID line */ - do i = 1 to words( szLine ) - w = translate( word( szLine, i )) - if pos( "_COMP_ID", w ) > 0 then szCompName = w - if pos( "0X", w ) > 0 then szCompID = w - end - - /* clean them up */ - szCompName = left( szCompName, pos( "_", szCompName )-1 ) - szCompID = strip( szCompID, 'B', ';' ) - - /* This output will be included by errlparser.C */ - say " {" '"'szCompName'",' szCompID "}," - - end -end - - -szRC = stream( szInput, 'C', 'CLOSE' ) -if left( szRC, 5 ) <> 'READY' then signal halt - -return 0 - - -halt: -say 'Error: readcomps.rex problem' -exit 2 -- cgit v1.2.1