2010-01-18 16:34 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)

* include/hbcompdf.h
  * src/compiler/cmdcheck.c
  * src/compiler/hbmain.c
  * src/compiler/hbcomp.c
  * src/compiler/hbopt.c
  * src/compiler/hbusage.c
  * src/compiler/hbgenerr.c
    + Added options to control error/warning output format/style
      in Harbour, to make it possible to switch to formats which
      are handled by popular IDEs, like Eclipse, Code::Blocks.
      Currently these are supported:
        -ge[0]: Clipper compatible (default)
        -ge1:   "IDE friendly". Mimics the one submitted by Lorenzo
                for Eclipse.
      The goal is to cover the most IDEs with the less options,
      so please test them to reach this optimum.
This commit is contained in:
Viktor Szakats
2010-01-18 15:36:56 +00:00
parent dd01a942b1
commit a894400a85
8 changed files with 80 additions and 11 deletions

View File

@@ -17,6 +17,24 @@
past entries belonging to author(s): Viktor Szakats.
*/
2010-01-18 16:34 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* include/hbcompdf.h
* src/compiler/cmdcheck.c
* src/compiler/hbmain.c
* src/compiler/hbcomp.c
* src/compiler/hbopt.c
* src/compiler/hbusage.c
* src/compiler/hbgenerr.c
+ Added options to control error/warning output format/style
in Harbour, to make it possible to switch to formats which
are handled by popular IDEs, like Eclipse, Code::Blocks.
Currently these are supported:
-ge[0]: Clipper compatible (default)
-ge1: "IDE friendly". Mimics the one submitted by Lorenzo
for Eclipse.
The goal is to cover the most IDEs with the less options,
so please test them to reach this optimum.
2010-01-18 15:53 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/src/common/hbwince.c
- removed LocalLock()/LocalUnlock()/LocalHandle() function wrappers
@@ -6529,8 +6547,8 @@
Peer-review me pls.
2009-12-13 22:47 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* src/compiler/hbmain.c
* src/compiler/cmdcheck.c
* src/compiler/hbmain.c
* src/compiler/hbcomp.c
* src/compiler/hbusage.c
* include/hbcompdf.h

View File

@@ -71,6 +71,13 @@ typedef enum
HB_LANG_PORT_OBJ_BUF /* Portable objects in memory buffer */
} HB_LANGUAGES; /* supported Harbour output languages */
/* Error message format modes */
typedef enum
{
HB_ERRORFMT_CLIPPER,
HB_ERRORFMT_IDE
} HB_ERRORFMT;
struct _COMCLASS; /* forward declaration */
/* Declared Function/Method support structure */
@@ -699,6 +706,7 @@ typedef struct _HB_COMP
int ilastLineErr; /* line numer with last syntax error */
int iTraceInclude; /* trace included files and generate dependencies list */
int iSyntaxCheckOnly; /* syntax check only */
int iErrorFmt; /* error message formatting mode (default: Clipper) */
HB_BOOL fQuiet; /* be quiet during compilation (-q) */
HB_BOOL fFullQuiet; /* be quiet during compilation disable all messages */

View File

@@ -272,6 +272,24 @@ static void hb_compChkEnvironVar( HB_COMP_DECL, const char *szSwitch )
hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'F', HB_COMP_ERR_BADOPTION, s, NULL );
break;
case 'e':
case 'E':
switch( *( s + 2 ) )
{
case '1':
HB_COMP_PARAM->iErrorFmt = HB_ERRORFMT_IDE;
break;
case '\0':
case '0':
HB_COMP_PARAM->iErrorFmt = HB_ERRORFMT_CLIPPER;
break;
default:
hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'F', HB_COMP_ERR_BADOPTION, s, NULL );
}
break;
#ifdef HB_GEN_OBJ32
case 'w':
case 'W':

View File

@@ -238,9 +238,10 @@ HB_COMP_PTR hb_comp_new( void )
pComp->iWarnings = 0; /* enable parse warnings */
pComp->iErrorCount = 0; /* number of compile errors */
pComp->iGenCOutput= HB_COMPGENC_COMPACT; /* C code generation default mode */
pComp->iExitLevel = HB_EXITLEVEL_DEFAULT; /* holds if there was any warning during the compilation process */
pComp->iLanguage = HB_LANG_C; /* default Harbour generated output language */
pComp->iGenCOutput = HB_COMPGENC_COMPACT; /* C code generation default mode */
pComp->iExitLevel = HB_EXITLEVEL_DEFAULT; /* holds if there was any warning during the compilation process */
pComp->iLanguage = HB_LANG_C; /* default Harbour generated output language */
pComp->iErrorFmt = HB_ERRORFMT_CLIPPER; /* default Harbour generated output language */
}
return pComp;

View File

@@ -156,13 +156,26 @@ static void hb_compDispMessage( HB_COMP_DECL, char cPrefix, int iValue,
if( HB_COMP_PARAM->currModule )
{
hb_snprintf( buffer, sizeof( buffer ), "\r%s(%i) ",
if( HB_COMP_PARAM->iErrorFmt == HB_ERRORFMT_CLIPPER )
hb_snprintf( buffer, sizeof( buffer ), "\r%s(%i) ",
HB_COMP_PARAM->currModule, HB_COMP_PARAM->currLine );
else if( HB_COMP_PARAM->currLine )
hb_snprintf( buffer, sizeof( buffer ), "\n%s:%i: ",
HB_COMP_PARAM->currModule, HB_COMP_PARAM->currLine );
else
hb_snprintf( buffer, sizeof( buffer ), "\n%s:%s ",
HB_COMP_PARAM->currModule, szPar2 );
hb_compOutErr( HB_COMP_PARAM, buffer );
}
hb_snprintf( buffer, sizeof( buffer ), "%s %c%04i ",
cPrefix == 'W' ? "Warning" : "Error", cPrefix, iValue );
if( HB_COMP_PARAM->iErrorFmt == HB_ERRORFMT_CLIPPER )
hb_snprintf( buffer, sizeof( buffer ), "%s %c%04i ",
cPrefix == 'W' ? "Warning" : "Error", cPrefix, iValue );
else
hb_snprintf( buffer, sizeof( buffer ), "%s %c%04i ",
cPrefix == 'W' ? "warning" : "error", cPrefix, iValue );
hb_compOutErr( HB_COMP_PARAM, buffer );
hb_snprintf( buffer, sizeof( buffer ), szText, szPar1, szPar2 );
hb_compOutErr( HB_COMP_PARAM, buffer );

View File

@@ -1706,7 +1706,10 @@ static void hb_compWarnUnusedVar( HB_COMP_DECL, const char * szFuncName,
const char * szVarName, int iDeclLine )
{
char szFun[ HB_SYMBOL_NAME_LEN + 17 ];
hb_snprintf( szFun, sizeof( szFun ), "%s(%i)", szFuncName, iDeclLine );
if( HB_COMP_PARAM->iErrorFmt == HB_ERRORFMT_CLIPPER )
hb_snprintf( szFun, sizeof( szFun ), "%s(%i)", szFuncName, iDeclLine );
else
hb_snprintf( szFun, sizeof( szFun ), "%i:%s", iDeclLine, szFuncName );
hb_compGenWarning( HB_COMP_PARAM, hb_comp_szWarnings, 'W',
HB_COMP_WARN_VAR_NOT_USED, szVarName, szFun );
}

View File

@@ -1424,7 +1424,10 @@ static void hb_compPCodeEnumAssignedUnused( HB_COMP_DECL, PFUNCTION pFunc, PHB_O
To obtain real line number we need one more tree scan or other
algorithm. [Mindaugas] */
hb_snprintf( szFun, sizeof( szFun ), "%s(%i)", pFunc->szName, usLine );
if( HB_COMP_PARAM->iErrorFmt == HB_ERRORFMT_CLIPPER )
hb_snprintf( szFun, sizeof( szFun ), "%s(%i)", pFunc->szName, usLine );
else
hb_snprintf( szFun, sizeof( szFun ), "%i:%s", usLine, pFunc->szName );
hb_compGenWarning( HB_COMP_PARAM, hb_comp_szWarnings, 'W', HB_COMP_WARN_ASSIGNED_UNUSED, pVar->szName, szFun );
}
}
@@ -1600,9 +1603,12 @@ void hb_compPCodeTraceOptimizer( HB_COMP_DECL )
if( usIndex >= pFunc->wParamCount && pLocals[ usIndex ].bFlags == OPT_LOCAL_FLAG_PUSH )
{
char szFun[ 256 ];
char szFun[ 256 ];
hb_snprintf( szFun, sizeof( szFun ), "%s(%i)", pFunc->szName, pVar->iDeclLine );
if( HB_COMP_PARAM->iErrorFmt == HB_ERRORFMT_CLIPPER )
hb_snprintf( szFun, sizeof( szFun ), "%s(%i)", pFunc->szName, pVar->iDeclLine );
else
hb_snprintf( szFun, sizeof( szFun ), "%i:%s", pVar->iDeclLine, pFunc->szName );
hb_compGenWarning( HB_COMP_PARAM, hb_comp_szWarnings, 'W', HB_COMP_WARN_NEVER_ASSIGNED, pVar->szName, szFun );
}

View File

@@ -78,6 +78,8 @@ void hb_compPrintUsage( HB_COMP_DECL, const char * szSelf )
#endif
"\n %cgh output type: Harbour Portable Object (.hrb)",
"\n %cgd[.<destext>] generate dependencies list into (.d) file",
"\n %cge[<mode>] error output <mode>: 0=Clipper (default)",
"\n 1=IDE friendly",
"\n %ci<path> #include file search path",
"\n %ci[-|+] disable/enable support for INCLUDE envvar",
"\n %cj[<file>] generate i18n gettext file (.pot)",