Makopo/lslint

Compilation error in XP-build

Closed this issue · 5 comments

Setting SDK environment relative to C:\Program Files\Microsoft SDKs\Windows\v7.1\.
Targeting Windows XP x86 Release


Microsoft (R) Program Maintenance Utility Version 10.00.30319.01
Copyright (C) Microsoft Corporation.  All rights reserved.

        win_flex lslmini.l
        win_bison -d -v lslmini.y
        cl.exe  -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -D_MT -MT /TP /D_MBCS /DYY_NO_UNISTD_H /EHsc /w lslmini.tab.c
lslmini.tab.c
z:\lslint\lslmini.hh(160) : error C2146: syntax error : missing ';' before identifier 'get_value'
z:\lslint\lslmini.hh(160) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
z:\lslint\lslmini.hh(160) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
z:\lslint\lslmini.hh(165) : error C2146: syntax error : missing ';' before identifier 'value'
z:\lslint\lslmini.hh(165) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
z:\lslint\lslmini.hh(165) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
z:\lslint\lslmini.hh(150) : error C2614: 'LLScriptIntegerConstant' : illegal member initialization: 'value' is not a base or member
z:\lslint\lslmini.hh(154) : error C2065: 'value' : undeclared identifier
z:\lslint\lslmini.hh(160) : error C2065: 'value' : undeclared identifier
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\Bin\cl.exe"' : return code '0x2'
Stop.

Using latest Win flex-bison, issue still persists.

Looking into these code:

lslint/lslmini.hh

Lines 145 to 168 in 0fd9454

/////////////////////////////////////////////////////
// Integer Constant
class LLScriptIntegerConstant : public LLScriptConstant {
public:
LLScriptIntegerConstant( int v, int isbool = 0 ) : LLScriptConstant(), value(v), is_bool(isbool) { type = TYPE(LST_INTEGER); }
virtual const char *get_node_name() {
static char buf[256];
sprintf(buf, "integer constant: %d", value);
return (const char *)buf;
}
virtual LLNodeSubType get_node_sub_type() { return NODE_INTEGER_CONSTANT; }
int32_t get_value() { return value; }
int get_is_bool() { return is_bool; }
virtual LLScriptConstant *operation(int op, LLScriptConstant *other_const, YYLTYPE *lloc);
private:
int32_t value;
int is_bool;
};

Simply replacing all int32_t to int will resolve this issue though it will revert 13e071b from @Sei-Lisa. Any thoughts?

I don't have an XP compile environment, but since builtins.cc is already using int32_t without problems, and it just does #include <stdint.h>, the fix is probably as simple as this:

diff --git a/lslmini.hh b/lslmini.hh
index 61ea3c5..3728b07 100644
--- a/lslmini.hh
+++ b/lslmini.hh
@@ -5,6 +5,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <ctype.h> // isprint()
+#include <stdint.h>
 #include <cstdarg>
 #include <set>
 #include <string>

Can you please try and see if that suffices to fix the build?

Thank you. I have tested above and confirmed all windows build worked well.