Browse Source

* Notes/hints changes

pierre 26 years ago
parent
commit
62da9bd4c0

+ 7 - 20
compiler/Makefile.fpc

@@ -1,9 +1,10 @@
 #
-#   Makefile.fpc for Free Pascal Compiler
+#   Makefile.fpc for shedit
 #
 
 [dirs]
 fpcdir=..
+unitdir=
 targetdir=.
 
 [defaults]
@@ -15,20 +16,6 @@ toolcmp=1
 
 
 [presettings]
-# Allow ALPHA, POWERPC, M68K, I386 defines for target cpu
-ifdef ALPHA
-CPU_TARGET=alpha
-endif
-ifdef POWERPC
-CPU_TARGET=powerpc
-endif
-ifdef M68K
-CPU_TARGET=m68k
-endif
-ifdef I386
-CPU_TARGET=i386
-endif
-
 # RTL
 RTL=../rtl
 UTILS=../utils
@@ -67,15 +54,15 @@ MSGFILE=error$(FPCLANG).msg
 # set correct defines (-d$(CPU_TARGET) is automaticly added in makefile.fpc)
 override LOCALDEF+=-dGDB -dBROWSERLOG
 
-# i386 specific
+# for i386 also insert MMX support
 ifeq ($(CPU_TARGET),i386)
-# also insert MMX support
 override LOCALDEF+=-dSUPPORT_MMX
+endif
+
 # We don't need the intel and binary writer on linux...
 ifdef inlinux
 override LOCALDEF+=-dNOAG386INT -dNOAG386BIN
 endif
-endif
 
 override LOCALOPT+=$(LOCALDEF)
 
@@ -275,8 +262,8 @@ ifdef inlinux
         $(INSTALLEXE) $(EXENAME) $(LIBINSTALLDIR)
 else
         $(MKDIR) $(BININSTALLDIR)
-ifdef UPXPROG
-        -$(UPXPROG) $(EXENAME)
+ifdef UPX
+        -$(UPX) $(EXENAME)
 endif
         $(INSTALLEXE) $(EXENAME) $(BININSTALLDIR)
 endif

+ 5 - 2
compiler/browlog.pas

@@ -27,7 +27,7 @@ unit browlog;
 
 interface
 uses
-  cobjects,globtype,files,symtable;
+  cobjects,globtype,files,symconst,symtable;
 
 const
 {$ifdef TP}
@@ -448,7 +448,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.2  1999-08-03 22:02:30  peter
+  Revision 1.3  1999-11-17 17:04:58  pierre
+   * Notes/hints changes
+
+  Revision 1.2  1999/08/03 22:02:30  peter
     * moved bitmask constants to sets
     * some other type/const renamings
 

+ 5 - 2
compiler/cga68k.pas

@@ -774,7 +774,7 @@ begin
             begin
                 if procinfo^.retdef<>pdef(voiddef) then
                     begin
-                        if not procinfo^.funcret_is_valid then
+                        if procinfo^.funcret_state<>vs_assigned then
                           CGMessage(sym_w_function_result_not_set);
                         new(hr);
                         reset_reference(hr^);
@@ -1391,7 +1391,10 @@ end;
 end.
 {
   $Log$
-  Revision 1.37  1999-11-09 23:06:44  peter
+  Revision 1.38  1999-11-17 17:04:58  pierre
+   * Notes/hints changes
+
+  Revision 1.37  1999/11/09 23:06:44  peter
     * esi_offset -> selfpointer_offset to be newcg compatible
     * hcogegen -> cgbase fixes for newcg
 

+ 7 - 4
compiler/cgai386.pas

@@ -3127,11 +3127,11 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
   begin
       if procinfo^.retdef<>pdef(voiddef) then
           begin
-              if ((procinfo^.flags and pi_operator)<>0) and
+              {if ((procinfo^.flags and pi_operator)<>0) and
                  assigned(opsym) then
                 procinfo^.funcret_is_valid:=
-                  procinfo^.funcret_is_valid or (opsym^.refs>0);
-              if not(procinfo^.funcret_is_valid) and not inlined { and
+                  procinfo^.funcret_is_valid or (opsym^.refs>0);}
+              if (procinfo^.funcret_state<>vs_assigned) and not inlined { and
                 ((procinfo^.flags and pi_uses_asm)=0)} then
                CGMessage(sym_w_function_result_not_set);
               hr:=new_reference(procinfo^.framepointer,procinfo^.retoffset);
@@ -3447,7 +3447,10 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
 end.
 {
   $Log$
-  Revision 1.59  1999-11-15 14:04:00  pierre
+  Revision 1.60  1999-11-17 17:04:58  pierre
+   * Notes/hints changes
+
+  Revision 1.59  1999/11/15 14:04:00  pierre
    * self pointer stabs for local function was wrong
 
   Revision 1.58  1999/11/09 23:06:44  peter

+ 10 - 2
compiler/errore.msg

@@ -1013,12 +1013,20 @@ sym_e_ill_type_decl_set=E_illegal type declaration of set elements
 % The declaration of a set contains an invalid type definition.
 sym_e_class_forward_not_resolved=E_Forward class definition not resolved $1
 % You declared a class, but you didn't implement it.
-sym_h_para_identifier_not_used=H_Parameter not used $1
+sym_h_para_identifier_not_used=H_Parameter $1 not used
 % This is a warning. The identifier was declared (locally or globally) but
 % wasn't used (locally or globally).
-sym_n_local_identifier_not_used=N_Local variable not used $1
+sym_n_local_identifier_not_used=N_Local variable $1 not used
 % You have declared, but not used a variable in a procedure or function
 % implementation.
+sym_h_para_identifier_only_set=H_Const or value parameter $1 is set but not used
+% This is a warning. The identifier was declared (locally or globally)
+% set but not used (locally or globally).
+sym_n_local_identifier_only_set=N_Local variable $1 is set but not used
+% The variable in a procedure or function
+% implementation is declared, set but never used.
+sym_h_local_symbol_not_used=H_Local $1 $2 is not used
+% A local symbol is never used.
 sym_e_set_expected=E_Set type expected
 % The variable or expression isn't of type \var{set}. This happens in an
 % \var{in} statement.

+ 10 - 3
compiler/globals.pas

@@ -327,13 +327,13 @@ unit globals;
 
     function assigned(p : pointer) : boolean;
 
+{$ifndef FPC}
+    {$ifndef DPMI}
       type
          ptrrec = record
             ofs,seg : word;
          end;
 
-{$ifndef FPC}
-    {$ifndef DPMI}
       var
          lp : longint;
     {$endif DPMI}
@@ -948,9 +948,13 @@ unit globals;
    function FixFileName(const s:string):string;
      var
        i      : longint;
+      {$ifdef Linux}
        NoPath : boolean;
+      {$endif Linux}
      begin
+      {$ifdef Linux}
        NoPath:=true;
+      {$endif Linux}
        for i:=length(s) downto 1 do
         begin
           case s[i] of
@@ -1351,7 +1355,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.34  1999-11-15 17:42:41  pierre
+  Revision 1.35  1999-11-17 17:04:59  pierre
+   * Notes/hints changes
+
+  Revision 1.34  1999/11/15 17:42:41  pierre
    * -g disables reloc section for win32
 
   Revision 1.33  1999/11/12 11:03:50  peter

+ 7 - 3
compiler/hcodegen.pas

@@ -33,7 +33,7 @@ implementation
     uses
       cobjects,
       tokens,verbose,
-      aasm,symtable,cpubase;
+      aasm,symconst,symtable,cpubase;
 
     const
        pi_uses_asm  = $1;       { set, if the procedure uses asm }
@@ -74,7 +74,8 @@ implementation
           { firsttemp position }
           firsttemp : longint;
 
-          funcret_is_valid : boolean;
+          { funcret_is_valid : boolean; }
+          funcret_state : tvarstate;
 
           { parameter offset }
           call_offset : longint;
@@ -374,7 +375,10 @@ end.
 
 {
   $Log$
-  Revision 1.48  1999-11-09 23:06:45  peter
+  Revision 1.49  1999-11-17 17:04:59  pierre
+   * Notes/hints changes
+
+  Revision 1.48  1999/11/09 23:06:45  peter
     * esi_offset -> selfpointer_offset to be newcg compatible
     * hcogegen -> cgbase fixes for newcg
 

+ 4 - 4
compiler/i386ins.dat

@@ -234,7 +234,7 @@ void                  \2\x0F\x06                      286,PRIV
 void                  \1\xF5                          8086
 
 [CMP,cmpX]
-(Ch_ROp1, Ch_ROp2, Ch_WFlags)
+(Ch_WFlags, Ch_None, Ch_None)
 mem,reg8              \300\1\x38\101                  8086,SM
 reg8,reg8             \300\1\x38\101                  8086
 mem,reg16             \320\300\1\x39\101              8086,SM
@@ -2276,14 +2276,14 @@ mem,imm16             \320\300\1\x81\206\31           8086,SM
 mem,imm32             \321\300\1\x81\206\41           386,SM
 
 [CMOVcc,cmovCCX]
-(Ch_ROp1, Ch_WOp2, Ch_RFLAGS)
+(Ch_All, Ch_None, Ch_None)
 reg16,mem             \320\301\1\x0F\330\x40\110      P6,SM
 reg16,reg16           \320\301\1\x0F\330\x40\110      P6
 reg32,mem             \321\301\1\x0F\330\x40\110      P6,SM
 reg32,reg32           \321\301\1\x0F\330\x40\110      P6
 
 [Jcc]
-(Ch_None, Ch_None, Ch_None)
+(Ch_All, Ch_None, Ch_None)
 imm|near              \322\1\x0F\330\x80\64           386,PASS2
 imm16|near            \320\1\x0F\330\x80\64           386,PASS2
 imm32|near            \321\1\x0F\330\x80\64           386,PASS2
@@ -2291,7 +2291,7 @@ imm                   \330\x70\50                     8086
 imm|short             \330\x70\50                     8086,ND
 
 [SETcc,setCCX]
-(Ch_RFLAGS, Ch_WOp1, Ch_None)
+(Ch_All, Ch_None, Ch_None)
 mem                   \300\1\x0F\330\x90\200          386,SB
 reg8                  \300\1\x0F\330\x90\200          386
 

+ 3 - 0
compiler/msgidx.inc

@@ -272,6 +272,9 @@ type tmsgconst=(
   sym_e_class_forward_not_resolved,
   sym_h_para_identifier_not_used,
   sym_n_local_identifier_not_used,
+  sym_h_para_identifier_only_set,
+  sym_n_local_identifier_only_set,
+  sym_h_local_symbol_not_used,
   sym_e_set_expected,
   sym_w_function_result_not_set,
   sym_e_illegal_field,

+ 122 - 119
compiler/msgtxt.inc

@@ -288,393 +288,396 @@ const msgtxt : array[0..000104,1..240] of char=(
   'E_label already defined'#000+
   'E_ill','egal type declaration of set elements'#000+
   'E_Forward class definition not resolved $1'#000+
-  'H_Parameter not used $1'#000+
-  'N_Local variable not used $1'#000+
+  'H_Parameter $1 not used'#000+
+  'N_Local variable $1 not used'#000+
+  'H_Const or value parameter $1 is set but not used'#000+
+  'N_Local variable $1 is set but not used'#000+
+  'H_Local $1 $2 is',' not used'#000+
   'E_Set type expected'#000+
   'W_Function result does not seem to be set'#000+
   'E_Unknown record field identifier $1'#000+
-  'W_Local',' variable $1 does not seem to be initialized'#000+
+  'W_Local variable $1 does not seem to be initialized'#000+
   'W_Variable $1 does not seem to be initialized'#000+
-  'E_identifier idents no member $1'#000+
+  'E_identifier idents no member $1'#000,
   'B_Found declaration: $1'#000+
   'E_Data segment too large (max. 2GB)'#000+
   'E_BREAK not allowed'#000+
   'E_CONTINUE not allowed'#000+
-  'E_Expression ','too complicated - FPU stack overflow'#000+
+  'E_Expression too complicated - FPU stack overflow'#000+
   'E_Illegal expression'#000+
   'E_Invalid integer expression'#000+
   'E_Illegal qualifier'#000+
-  'E_High range limit < low range limit'#000+
+  'E_High range limi','t < low range limit'#000+
   'E_Illegal counter variable'#000+
   'E_Can'#039't determine which overloaded function to call'#000+
-  'E_Parameter list ','size exceeds 65535 bytes'#000+
+  'E_Parameter list size exceeds 65535 bytes'#000+
   'E_Illegal type conversion'#000+
   'D_Conversion between ordinals and pointers is not portable across plat'+
-  'forms'#000+
+  'for','ms'#000+
   'E_File types must be var parameters'#000+
   'E_The use of a far pointer isn'#039't allowed there'#000+
-  'E_illegal call by reference pa','rameters'#000+
+  'E_illegal call by reference parameters'#000+
   'E_EXPORT declared functions can'#039't be called'#000+
   'W_Possible illegal call of constructor or destructor (doesn'#039't matc'+
-  'h to this context)'#000+
+  'h to ','this context)'#000+
   'N_Inefficient code'#000+
   'W_unreachable code'#000+
   'E_procedure call with stackframe ESP/SP'#000+
-  'E_Abstract methods can'#039't',' be called directly'#000+
+  'E_Abstract methods can'#039't be called directly'#000+
   'F_Internal Error in getfloatreg(), allocation failure'#000+
   'F_Unknown float type'#000+
-  'F_SecondVecn() base defined twice'#000+
+  'F_SecondVecn() base defined t','wice'#000+
   'F_Extended cg68k not supported'#000+
   'F_32-bit unsigned not supported in MC68000 mode'#000+
-  'F_Internal Error in secondinline','()'#000+
+  'F_Internal Error in secondinline()'#000+
   'D_Register $1 weight $2 $3'#000+
   'E_Stack limit excedeed in local routine'#000+
   'D_Stack frame is omitted'#000+
-  'E_Object or class methods can'#039't be inline.'#000+
+  'E_Object or class methods can',#039't be inline.'#000+
   'E_Procvar calls can'#039't be inline.'#000+
   'E_No code for inline procedure stored'#000+
-  'E_Direct call of interrupt proc','edure $1 is not possible'#000+
+  'E_Direct call of interrupt procedure $1 is not possible'#000+
   'E_Element zero of an ansi/wide- or longstring can'#039't be accessed, u'+
   'se (set)length instead'#000+
-  'E_Include and exclude not implemented in this case'#000+
+  'E_Include ','and exclude not implemented in this case'#000+
   'E_Constructors or destructors can not be called inside a '#039'with'#039+
   ' clause'#000+
-  'E_Ca','nnot call message handler method directly'#000+
+  'E_Cannot call message handler method directly'#000+
   'D_Starting $1 styled assembler parsing'#000+
   'D_Finished $1 styled assembler parsing'#000+
-  'E_Non-label pattern contains @'#000+
+  'E_No','n-label pattern contains @'#000+
   'W_Override operator not supported'#000+
   'E_Error building record offset'#000+
-  'E_OFFSET used without id','entifier'#000+
+  'E_OFFSET used without identifier'#000+
   'E_TYPE used without identifier'#000+
   'E_Cannot use local variable or parameters here'#000+
   'E_need to use OFFSET here'#000+
-  'E_Cannot use multiple relocatable symbols'#000+
+  'E_Cannot us','e multiple relocatable symbols'#000+
   'E_Relocatable symbol can only be added'#000+
   'E_Invalid constant expression'#000+
-  'E_Relocatable sy','mbol is not allowed'#000+
+  'E_Relocatable symbol is not allowed'#000+
   'E_Invalid reference syntax'#000+
   'E_Local symbols/labels aren'#039't allowed as references'#000+
-  'E_Invalid base and index register usage'#000+
+  'E_Invalid base and index ','register usage'#000+
   'E_Wrong scale factor specified'#000+
   'E_Multiple index register usage'#000+
   'E_Invalid operand type'#000+
-  'E_Invalid strin','g as opcode operand: $1'#000+
+  'E_Invalid string as opcode operand: $1'#000+
   'W_@CODE and @DATA not supported'#000+
   'E_Null label references are not allowed'#000+
-  'F_Divide by zero in asm evaluator'#000+
+  'F_Divide by zero in asm eval','uator'#000+
   'F_Evaluator stack overflow'#000+
   'F_Evaluator stack underflow'#000+
   'F_Invalid numeric format in asm evaluator'#000+
-  'F_Invalid Ope','rator in asm evaluator'#000+
+  'F_Invalid Operator in asm evaluator'#000+
   'E_escape sequence ignored: $1'#000+
   'E_Invalid symbol reference'#000+
-  'W_Fwait can cause emulation problems with emu387'#000+
+  'W_Fwait can cause emulation problems with em','u387'#000+
   'W_Calling an overload function in assembler'#000+
   'E_Unsupported symbol type for operand'#000+
-  'E_Constant value out of bound','s'#000+
+  'E_Constant value out of bounds'#000+
   'E_Error converting decimal $1'#000+
   'E_Error converting octal $1'#000+
   'E_Error converting binary $1'#000+
   'E_Error converting hexadecimal $1'#000+
-  'H_$1 translated to $2'#000+
+  'H','_$1 translated to $2'#000+
   'W_$1 is associated to an overloaded function'#000+
   'E_Cannot use SELF outside a method'#000+
-  'E_Cannot use OL','DEBP outside a nested procedure'#000+
+  'E_Cannot use OLDEBP outside a nested procedure'#000+
   'W_Functions with void return value can'#039't return any value in asm c'+
   'ode'#000+
   'E_SEG not supported'#000+
-  'E_Size suffix and destination or source size do not match'#000+
+  'E_','Size suffix and destination or source size do not match'#000+
   'W_Size suffix and destination or source size do not match'#000+
-  'E_','Assembler syntax error'#000+
+  'E_Assembler syntax error'#000+
   'E_Invalid combination of opcode and operands'#000+
   'E_Assemler syntax error in operand'#000+
-  'E_Assemler syntax error in constant'#000+
+  'E_Assemler syntax err','or in constant'#000+
   'E_Invalid String expression'#000+
   '32bit constant created for address'#000+
   'E_Invalid or missing opcode'#000+
-  'E_Invalid ','combination of prefix and opcode: $1'#000+
+  'E_Invalid combination of prefix and opcode: $1'#000+
   'E_Invalid combination of override and opcode: $1'#000+
   'E_Too many operands on line'#000+
-  'W_NEAR ignored'#000+
+  'W_NEAR ign','ored'#000+
   'W_FAR ignored'#000+
   'E_Duplicate local symbol $1'#000+
   'E_Undefined local symbol $1'#000+
   'E_Unknown label identifier $1'#000+
-  'E_Invalid f','loating point register name'#000+
+  'E_Invalid floating point register name'#000+
   'E_NOR not supported'#000+
   'W_Modulo not supported'#000+
   'E_Invalid floating point constant $1'#000+
-  'E_Invalid floating point expression'#000+
+  'E_Invalid floati','ng point expression'#000+
   'E_Wrong symbol type'#000+
   'E_Cannot index a local var or parameter with a register'#000+
-  'E_Invalid segment ov','erride expression'#000+
+  'E_Invalid segment override expression'#000+
   'W_Identifier $1 supposed external'#000+
   'E_Strings not allowed as constants'#000+
   'No type of variable specified'#000+
-  'E_assembler code not returned to text section'#000+
+  'E_assem','bler code not returned to text section'#000+
   'E_Not a directive or local symbol $1'#000+
-  'E_Using a defined name as a local label'#000,
+  'E_Using a defined name as a local label'#000+
   'E_Dollar token is used without an identifier'#000+
   'W_32bit constant created for address'#000+
-  'N_.align is target specific, use .balign or .p2align'#000+
+  'N_.align is target specific, use .balign o','r .p2align'#000+
   'E_Can'#039't access fields directly for parameters'#000+
   'E_Can'#039't access fields of objects/classes directly'#000+
-  'F_Too man','y assembler files'#000+
+  'F_Too many assembler files'#000+
   'F_Selected assembler output not supported'#000+
   'F_Comp not supported'#000+
   'F_Direct not support for binary writers'#000+
-  'E_Allocating of data is only allowed in bss section'#000+
+  'E_A','llocating of data is only allowed in bss section'#000+
   'F_No binary writer selected'#000+
   'E_Asm: Opcode $1 not in table'#000+
-  'E_Asm: $1',' invalid combination of opcode and operands'#000+
+  'E_Asm: $1 invalid combination of opcode and operands'#000+
   'E_Asm: 16 Bit references not supported'#000+
   'E_Asm: Invalid effective address'#000+
-  'E_Asm: Immediate or reference expected'#000+
+  'E_Asm: I','mmediate or reference expected'#000+
   'E_Asm: $1 value exceeds bounds $2'#000+
   'E_Asm: Short jump is out of range $1'#000+
-  'W_Source opera','ting system redefined'#000+
+  'W_Source operating system redefined'#000+
   'I_Assembling (pipe) $1'#000+
   'E_Can'#039't create assember file $1'#000+
-  'W_Assembler $1 not found, switching to external assembling'#000+
+  'W_Assembler $1 not found, switching to external',' assembling'#000+
   'T_Using assembler: $1'#000+
   'W_Error while assembling exitcode $1'#000+
-  'W_Can'#039't call the assembler, error $1 switchin','g to external assem'+
-  'bling'#000+
+  'W_Can'#039't call the assembler, error $1 switching to external assembl'+
+  'ing'#000+
   'I_Assembling $1'#000+
   'I_Assembling smartlink $1'#000+
   'W_Object $1 not found, Linking may fail !'#000+
-  'W_Library $1 not found, Linking may fail !'#000+
+  'W_Library $1 no','t found, Linking may fail !'#000+
   'W_Error while linking'#000+
   'W_Can'#039't call the linker, switching to external linking'#000+
-  'I_Linking $','1'#000+
+  'I_Linking $1'#000+
   'W_Util $1 not found, switching to external linking'#000+
   'T_Using util $1'#000+
   'E_Creation of Executables not supported'#000+
-  'E_Creation of Dynamic/Shared Libraries not supported'#000+
+  'E_Creation of D','ynamic/Shared Libraries not supported'#000+
   'I_Closing script $1'#000+
-  'W_resource compiler not found, switching to external mode'#000,
+  'W_resource compiler not found, switching to external mode'#000+
   'I_Compiling resource $1'#000+
   'F_Can'#039't post process executable $1'#000+
   'F_Can'#039't open executable $1'#000+
   'X_Size of Code: $1 bytes'#000+
-  'X_Size of initialized data: $1 bytes'#000+
+  'X_Size of ini','tialized data: $1 bytes'#000+
   'X_Size of uninitialized data: $1 bytes'#000+
   'X_Stack space reserved: $1 bytes'#000+
-  'X_Stack space commit','ed: $1 bytes'#000+
+  'X_Stack space commited: $1 bytes'#000+
   'T_Unitsearch: $1'#000+
   'T_PPU Loading $1'#000+
   'U_PPU Name: $1'#000+
   'U_PPU Flags: $1'#000+
   'U_PPU Crc: $1'#000+
   'U_PPU Time: $1'#000+
-  'U_PPU File too short'#000+
+  'U_PPU File too sh','ort'#000+
   'U_PPU Invalid Header (no PPU at the begin)'#000+
   'U_PPU Invalid Version $1'#000+
   'U_PPU is compiled for an other processor'#000+
-  'U_P','PU is compiled for an other target'#000+
+  'U_PPU is compiled for an other target'#000+
   'U_PPU Source: $1'#000+
   'U_Writing $1'#000+
   'F_Can'#039't Write PPU-File'#000+
   'F_reading PPU-File'#000+
-  'F_unexpected end of PPU-File'#000+
+  'F_unexpected end ','of PPU-File'#000+
   'F_Invalid PPU-File entry: $1'#000+
   'F_PPU Dbx count problem'#000+
   'E_Illegal unit name: $1'#000+
   'F_Too much units'#000+
-  'F_Circular',' unit reference between $1 and $2'#000+
+  'F_Circular unit reference between $1 and $2'#000+
   'F_Can'#039't compile unit $1, no sources available'#000+
   'F_Can'#039't find unit $1'#000+
-  'W_Unit $1 was not found but $2 exists'#000+
+  'W_Unit $1 was not found',' but $2 exists'#000+
   'F_Unit $1 searched but $2 found'#000+
   'W_Compiling the system unit requires the -Us switch'#000+
-  'F_There were $1 e','rrors compiling module, stopping'#000+
+  'F_There were $1 errors compiling module, stopping'#000+
   'U_Load from $1 ($2) unit $3'#000+
   'U_Recompiling $1, checksum changed for $2'#000+
-  'U_Recompiling $1, source found only'#000+
+  'U_Recompiling $1, sou','rce found only'#000+
   'U_Recompiling unit, static lib is older than ppufile'#000+
-  'U_Recompiling unit, shared lib is older than ppu','file'#000+
+  'U_Recompiling unit, shared lib is older than ppufile'#000+
   'U_Recompiling unit, obj and asm are older than ppufile'#000+
   'U_Recompiling unit, obj is older than asm'#000+
-  'U_Parsing interface of $1'#000+
+  'U_Parsing interface of',' $1'#000+
   'U_Parsing implementation of $1'#000+
   'U_Second load for unit $1'#000+
   'U_PPU Check file $1 time $2'#000+
-  '$1 [options] <inputfile> [o','ptions]'#000+
+  '$1 [options] <inputfile> [options]'#000+
   'W_Only one source file supported'#000+
   'W_DEF file can be created only for OS/2'#000+
   'E_nested response files are not supported'#000+
-  'F_No source file name in command line'#000+
+  'F','_No source file name in command line'#000+
   'E_Illegal parameter: $1'#000+
   'H_-? writes help pages'#000+
   'F_Too many config files nested'#000+
-  'F','_Unable to open file $1'#000+
+  'F_Unable to open file $1'#000+
   'N_Reading further options from $1'#000+
   'W_Target is already set to: $1'#000+
-  'W_Shared libs not supported on DOS platform, reverting to static'#000+
+  'W_Shared libs not supported on DOS ','platform, reverting to static'#000+
   'F_too many IF(N)DEFs'#000+
   'F_too many ENDIFs'#000+
   'F_open conditional at the end of the file'#000+
-  'W_Deb','ug information generation is not supported by this executable'#000+
+  'W_Debug information generation is not supported by this executable'#000+
   'H_Try recompiling with -dGDB'#000+
-  'E_You are using the obsolete switch $1'#000+
+  'E_You are using the obsolete swit','ch $1'#000+
   'E_You are using the obsolete switch $1, please use $2'#000+
-  'N_Switching assembler to default source writing assemble','r'#000+
+  'N_Switching assembler to default source writing assembler'#000+
   'Free Pascal Compiler version $FPCVER [$FPCDATE] for $FPCTARGET'#000+
   'Copyright (c) 1993-1999 by Florian Klaempfl'#000+
-  'Free Pascal Compiler version $FPCVER'#000+
+  'Free Pascal Com','piler version $FPCVER'#000+
   #000+
   'Compiler Date  : $FPCDATE'#000+
   'Compiler Target: $FPCTARGET'#000+
   #000+
-  'This program comes under the GNU Gener','al Public Licence'#000+
+  'This program comes under the GNU General Public Licence'#000+
   'For more information read COPYING.FPC'#000+
   #000+
   'Report bugs,suggestions etc to:'#000+
-  '                 [email protected]'#000+
+  '                 [email protected]','aturnus.vein.hu'#000+
   '**0*_put + after a boolean switch option to enable it, - to disable it'+
   #000+
-  '**1a_the compiler doesn'#039't del','ete the generated assembler file'#000+
+  '**1a_the compiler doesn'#039't delete the generated assembler file'#000+
   '**2al_list sourcecode lines in assembler file'#000+
-  '**2ar_list register allocation/release info in assembler file'#000+
+  '**2ar_list register allocation/release info i','n assembler file'#000+
   '**2at_list temp allocation/release info in assembler file'#000+
   '**1b_generate browser info'#000+
-  '**2bl_generate',' local symbol info'#000+
+  '**2bl_generate local symbol info'#000+
   '**1B_build all modules'#000+
   '**1C<x>_code generation options:'#000+
   '3*2CD_create dynamic library'#000+
-  '**2Ch<n>_<n> bytes heap (between 1023 and 67107840)'#000+
+  '**2Ch<n>_<n> bytes h','eap (between 1023 and 67107840)'#000+
   '**2Ci_IO-checking'#000+
   '**2Cn_omit linking stage'#000+
-  '**2Co_check overflow of integer operation','s'#000+
+  '**2Co_check overflow of integer operations'#000+
   '**2Cr_range checking'#000+
   '**2Cs<n>_set stack size to <n>'#000+
   '**2Ct_stack checking'#000+
-  '**2CD_create also dynamic library (* doesn'#039't work yet *)'#000+
+  '**2CD_create also dynamic library (* doesn'#039't work',' yet *)'#000+
   '**2CX_create also smartlinked library'#000+
   '**1d<x>_defines the symbol <x>'#000+
   '*O1D_generate a DEF file'#000+
-  '*O2Dd<x>_set d','escription to <x>'#000+
+  '*O2Dd<x>_set description to <x>'#000+
   '*O2Dw_PM application'#000+
   '**1e<x>_set path to executable'#000+
   '**1E_same as -Cn'#000+
   '**1F<x>_set file names and paths:'#000+
-  '**2FD<x>_sets the directory where to search for compiler utilities'#000+
+  '**2','FD<x>_sets the directory where to search for compiler utilities'#000+
   '**2Fe<x>_redirect error output to <x>'#000+
-  '**2FE<x>_set e','xe/unit output path to <x>'#000+
+  '**2FE<x>_set exe/unit output path to <x>'#000+
   '**2Fi<x>_adds <x> to include path'#000+
   '**2Fl<x>_adds <x> to library path'#000+
-  '*L2FL<x>_uses <x> as dynamic linker'#000+
+  '*L2FL<x>_uses <x> as dynamic ','linker'#000+
   '**2Fo<x>_adds <x> to object path'#000+
   '**2Fr<x>_load error message file <x>'#000+
   '**2Fu<x>_adds <x> to unit path'#000+
-  '**2FU<x>','_set unit output path to <x>, overrides -FE'#000+
+  '**2FU<x>_set unit output path to <x>, overrides -FE'#000+
   '*g1g<x>_generate debugger information:'#000+
   '*g2gg_use gsym'#000+
   '*g2gd_use dbx'#000+
-  '*g2gh_use heap trace unit'#000+
+  '*g2gh_use he','ap trace unit'#000+
   '*g2gc_generate checks for pointers'#000+
   '**1i_information'#000+
   '**2iD_return compiler date'#000+
-  '**2iV_return compiler v','ersion'#000+
+  '**2iV_return compiler version'#000+
   '**2iSO_return compiler OS'#000+
   '**2iSP_return compiler processor'#000+
   '**2iTO_return target OS'#000+
   '**2iTP_return target processor'#000+
-  '**1I<x>_adds <x> to include path'#000+
+  '**1','I<x>_adds <x> to include path'#000+
   '**1k<x>_Pass <x> to the linker'#000+
   '**1l_write logo'#000+
-  '**1n_don'#039't read the default config file',#000+
+  '**1n_don'#039't read the default config file'#000+
   '**1o<x>_change the name of the executable produced to <x>'#000+
   '**1pg_generate profile code for gprof (defines FPC_PROFILE)'#000+
-  '*L1P_use pipes instead of creating temporary assembler files'#000+
+  '*L1P_','use pipes instead of creating temporary assembler files'#000+
   '**1S<x>_syntax options:'#000+
-  '**2S2_switch some Delphi 2 extension','s on'#000+
+  '**2S2_switch some Delphi 2 extensions on'#000+
   '**2Sc_supports operators like C (*=,+=,/= and -=)'#000+
   '**2Sd_tries to be Delphi compatible'#000+
-  '**2Se<x>_compiler stops after the <x> errors (default is 1)'#000+
+  '**2Se<x>_compiler stops after the',' <x> errors (default is 1)'#000+
   '**2Sg_allow LABEL and GOTO'#000+
   '**2Sh_Use ansistrings'#000+
   '**2Si_support C++ styled INLINE'#000+
-  '**2Sm_su','pport macros like C (global)'#000+
+  '**2Sm_support macros like C (global)'#000+
   '**2So_tries to be TP/BP 7.0 compatible'#000+
   '**2Sp_tries to be gpc compatible'#000+
-  '**2Ss_constructor name must be init (destructor must be done)'#000+
+  '**2Ss_constructor name ','must be init (destructor must be done)'#000+
   '**2St_allow static keyword in objects'#000+
-  '**1s_don'#039't call assembler and linker (o','nly with -a)'#000+
+  '**1s_don'#039't call assembler and linker (only with -a)'#000+
   '**1u<x>_undefines the symbol <x>'#000+
   '**1U_unit options:'#000+
   '**2Un_don'#039't check the unit name'#000+
-  '**2Us_compile a system unit'#000+
+  '**2Us_compile a system unit',#000+
   '**1v<x>_Be verbose. <x> is a combination of the following letters:'#000+
-  '**2*_e : Show errors (default)       d : Show de','bug info'#000+
+  '**2*_e : Show errors (default)       d : Show debug info'#000+
   '**2*_w : Show warnings               u : Show unit info'#000+
-  '**2*_n : Show notes                  t : Show tried/used files'#000+
+  '**2*_n : Show notes                  t : Show tried/used fi','les'#000+
   '**2*_h : Show hints                  m : Show defined macros'#000+
-  '**2*_i : Show general info           p : Show compi','led procedures'#000+
+  '**2*_i : Show general info           p : Show compiled procedures'#000+
   '**2*_l : Show linenumbers            c : Show conditionals'#000+
-  '**2*_a : Show everything             0 : Show nothing (except errors)'#000+
-  '**2*_b : Show all procedure          r : Rhide/GCC compatibility mode'#000+
-  '**2*_    declarations if a','n error    x : Executable info (Win32 only'+
+  '**2*_a : Show everything             0 : Show noth','ing (except errors'+
   ')'#000+
+  '**2*_b : Show all procedure          r : Rhide/GCC compatibility mode'#000+
+  '**2*_    declarations if an error    x : Executable info (Win32 only)'#000+
   '**2*_    occurs'#000+
   '**1X_executable options:'#000+
   '*L2Xc_link with the c library'#000+
-  '**2Xs_strip all symbols from executable'#000+
+  '**2Xs_str','ip all symbols from executable'#000+
   '**2XD_try to link dynamic          (defines FPC_LINK_DYNAMIC)'#000+
-  '**2XS_try to link stati','c (default) (defines FPC_LINK_STATIC)'#000+
+  '**2XS_try to link static (default) (defines FPC_LINK_STATIC)'#000+
   '**2XX_try to link smart            (defines FPC_LINK_SMART)'#000+
-  '**0*_Processor specific options:'#000+
+  '**0*_Processor specific op','tions:'#000+
   '3*1A<x>_output format:'#000+
   '3*2Aas_assemble using GNU AS'#000+
   '3*2Aasaout_assemble using GNU AS for aout (Go32v1)'#000+
-  '3*2Ana','smcoff_coff (Go32v2) file using Nasm'#000+
+  '3*2Anasmcoff_coff (Go32v2) file using Nasm'#000+
   '3*2Anasmelf_elf32 (Linux) file using Nasm'#000+
   '3*2Anasmobj_obj file using Nasm'#000+
-  '3*2Amasm_obj file using Masm (Microsoft)'#000+
+  '3*2Amasm_obj ','file using Masm (Microsoft)'#000+
   '3*2Atasm_obj file using Tasm (Borland)'#000+
   '3*2Acoff_coff (Go32v2) using internal writer'#000+
-  '3*2A','pecoff_pecoff (Win32) using internal writer'#000+
+  '3*2Apecoff_pecoff (Win32) using internal writer'#000+
   '3*1R<x>_assembler reading style:'#000+
   '3*2Ratt_read AT&T style assembler'#000+
-  '3*2Rintel_read Intel style assembler'#000+
+  '3*2Rintel_rea','d Intel style assembler'#000+
   '3*2Rdirect_copy assembler text directly to assembler file'#000+
   '3*1O<x>_optimizations:'#000+
-  '3*2Og_gener','ate smaller code'#000+
+  '3*2Og_generate smaller code'#000+
   '3*2OG_generate faster code (default)'#000+
   '3*2Or_keep certain variables in registers (still BUGGY!!!)'#000+
-  '3*2Ou_enable uncertain optimizations (see docs)'#000+
+  '3*2Ou_enabl','e uncertain optimizations (see docs)'#000+
   '3*2O1_level 1 optimizations (quick optimizations)'#000+
-  '3*2O2_level 2 optimizations (','-O1 + slower optimizations)'#000+
+  '3*2O2_level 2 optimizations (-O1 + slower optimizations)'#000+
   '3*2O3_level 3 optimizations (same as -O2u)'#000+
   '3*2Op<x>_target processor:'#000+
-  '3*3Op1_set target processor to 386/486'#000+
+  '3*3Op1_set target processo','r to 386/486'#000+
   '3*3Op2_set target processor to Pentium/PentiumMMX (tm)'#000+
-  '3*3Op3_set target processor to PPro/PII/c6x86/K6',' (tm)'#000+
+  '3*3Op3_set target processor to PPro/PII/c6x86/K6 (tm)'#000+
   '3*1T<x>_Target operating system:'#000+
   '3*2TGO32V1_version 1 of DJ Delorie DOS extender'#000+
-  '3*2TGO32V2_version 2 of DJ Delorie DOS extender'#000+
+  '3*2TGO32V2_version 2 of DJ Delorie DO','S extender'#000+
   '3*2TLINUX_Linux'#000+
   '3*2TOS2_OS/2 2.x'#000+
   '3*2TWin32_Windows 32 Bit'#000+
   '6*1A<x>_output format'#000+
-  '6*2Aas_Unix o-file using ','GNU AS'#000+
+  '6*2Aas_Unix o-file using GNU AS'#000+
   '6*2Agas_GNU Motorola assembler'#000+
   '6*2Amit_MIT Syntax (old GAS)'#000+
   '6*2Amot_Standard Motorola assembler'#000+
   '6*1O_optimizations:'#000+
-  '6*2Oa_turn on the optimizer'#000+
+  '6','*2Oa_turn on the optimizer'#000+
   '6*2Og_generate smaller code'#000+
   '6*2OG_generate faster code (default)'#000+
-  '6*2Ox_optimize maximum (','still BUGGY!!!)'#000+
+  '6*2Ox_optimize maximum (still BUGGY!!!)'#000+
   '6*2O2_set target processor to a MC68020+'#000+
   '6*1R<x>_assembler reading style:'#000+
-  '6*2RMOT_read motorola style assembler'#000+
+  '6*2RMOT_read motorola style assemb','ler'#000+
   '6*1T<x>_Target operating system:'#000+
   '6*2TAMIGA_Commodore Amiga'#000+
   '6*2TATARI_Atari ST/STe/TT'#000+
   '6*2TMACOS_Macintosh m68k'#000+
-  '6*','2TLINUX_Linux-68k'#000+
+  '6*2TLINUX_Linux-68k'#000+
   '**1*_'#000+
   '**1?_shows this help'#000+
   '**1h_shows this help without waiting'#000

+ 5 - 1
compiler/pass_1.pas

@@ -78,6 +78,7 @@ implementation
          { no temps over several statements }
          cleartempgen;
          { right is the statement itself calln assignn or a complex one }
+         must_be_valid:=true;
          firstpass(p^.right);
          if (not (cs_extsyntax in aktmoduleswitches)) and
             assigned(p^.right^.resulttype) and
@@ -370,7 +371,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.107  1999-10-26 12:30:43  peter
+  Revision 1.108  1999-11-17 17:05:01  pierre
+   * Notes/hints changes
+
+  Revision 1.107  1999/10/26 12:30:43  peter
     * const parameter is now checked
     * better and generic check if a node can be used for assigning
     * export fixes

+ 11 - 6
compiler/pexpr.pas

@@ -905,9 +905,6 @@ unit pexpr;
                    (not ((m_tp in aktmodeswitches) and (afterassignment or in_args)))
                   ) then
                  begin
-                    if ((pvarsym(sym)=opsym) and
-                       ((p^.flags and pi_operator)<>0)) then
-                       inc(opsym^.refs);
                     if ((pvarsym(sym)=opsym) and
                        ((p^.flags and pi_operator)<>0)) then
                        inc(opsym^.refs);
@@ -916,12 +913,17 @@ unit pexpr;
                     p1^.funcretprocinfo:=p;
                     p1^.retdef:=pd;
                     is_func_ret:=true;
+                    if p^.funcret_state=vs_declared then
+                      begin
+                        p^.funcret_state:=vs_declared_and_first_found;
+                        p1^.is_first_funcret:=true;
+                      end;
                     exit;
                  end;
                p:=p^.parent;
             end;
           { we must use the function call }
-          if(sym^.typ=funcretsym) then
+          if (sym^.typ=funcretsym) then
             begin
                storesymtablestack:=symtablestack;
                symtablestack:=srsymtable^.next;
@@ -1003,7 +1005,7 @@ unit pexpr;
                                begin
                                  p1^.is_first := true;
                                  { set special between first loaded until checked in firstpass }
-                                 pvarsym(srsym)^.varstate:=vs_declared2;
+                                 pvarsym(srsym)^.varstate:=vs_declared_and_first_found;
                                end;
                               pd:=pvarsym(srsym)^.definition;
                             end;
@@ -2116,7 +2118,10 @@ _LECKKLAMMER : begin
 end.
 {
   $Log$
-  Revision 1.159  1999-11-15 17:52:59  pierre
+  Revision 1.160  1999-11-17 17:05:01  pierre
+   * Notes/hints changes
+
+  Revision 1.159  1999/11/15 17:52:59  pierre
     + one field added for ttoken record for operator
       linking the id to the corresponding operator token that
       can now now all be overloaded

+ 6 - 1
compiler/pmodules.pas

@@ -881,6 +881,8 @@ unit pmodules;
         {Generate a procsym for main}
         make_ref:=false;
         aktprocsym:=new(Pprocsym,init(name));
+        { main are allways used }
+        inc(aktprocsym^.refs);
         {Try to insert in in static symtable ! }
         stt:=symtablestack;
         symtablestack:=st;
@@ -1505,7 +1507,10 @@ unit pmodules;
 end.
 {
   $Log$
-  Revision 1.165  1999-11-15 15:03:47  pierre
+  Revision 1.166  1999-11-17 17:05:02  pierre
+   * Notes/hints changes
+
+  Revision 1.165  1999/11/15 15:03:47  pierre
     * Pavel's changes for reloc section in executable
     + warning that -g needs -WN under win32
 

+ 12 - 6
compiler/ppheap.pas

@@ -28,7 +28,7 @@ unit ppheap;
 
     { call this function before any memory allocation
       in a unit initialization code (PM) }
-      
+
     procedure pp_heap_init;
 
   implementation
@@ -37,18 +37,21 @@ unit ppheap;
        globtype,globals,files;
 
     procedure ppextra_info(p : pointer);
+      var pl : plongint;
       begin
          longint(p^):=aktfilepos.line;
-         plongint(cardinal(p)+4)^:=aktfilepos.column;
+         pl:=plongint(cardinal(p)+4);
+         pl^:=aktfilepos.column;
+         pl:=plongint(cardinal(p)+8);
          if assigned(current_module) then
-          plongint(cardinal(p)+8)^:=current_module^.unit_index*100000+aktfilepos.fileindex
+          pl^:=current_module^.unit_index*100000+aktfilepos.fileindex
          else
-          plongint(cardinal(p)+8)^:=aktfilepos.fileindex
+          pl^:=aktfilepos.fileindex
       end;
 
   const
      pp_heap_inited : boolean = false;
-     
+
   procedure pp_heap_init;
     begin
        if not pp_heap_inited then
@@ -69,7 +72,10 @@ unit ppheap;
 
 {
   $Log$
-  Revision 1.7  1999-06-08 15:26:49  pierre
+  Revision 1.8  1999-11-17 17:05:02  pierre
+   * Notes/hints changes
+
+  Revision 1.7  1999/06/08 15:26:49  pierre
    * fix to get it self compiled
 
   Revision 1.6  1999/05/17 15:09:28  pierre

+ 5 - 2
compiler/ppu.pas

@@ -30,7 +30,7 @@ interface
 var
   CRCFile : text;
 const
-  CRC_array_Size = 20000;
+  CRC_array_Size = 200000;
 type
   tcrc_array = array[0..crc_array_size] of longint;
   pcrc_array = ^tcrc_array;
@@ -1000,7 +1000,10 @@ end;
 end.
 {
   $Log$
-  Revision 1.47  1999-11-06 14:34:23  peter
+  Revision 1.48  1999-11-17 17:05:02  pierre
+   * Notes/hints changes
+
+  Revision 1.47  1999/11/06 14:34:23  peter
     * truncated log to 20 revs
 
   Revision 1.46  1999/09/17 09:14:56  peter

+ 9 - 7
compiler/pstatmnt.pas

@@ -372,10 +372,12 @@ unit pstatmnt;
       var
          right,hp,p : ptree;
          i,levelcount : longint;
+         store_valid : boolean;
          withsymtable,symtab : psymtable;
          obj : pobjectdef;
 
       begin
+         Store_valid := Must_be_valid;
          Must_be_valid:=false;
          p:=comp_expr(true);
          do_firstpass(p);
@@ -472,6 +474,7 @@ unit pstatmnt;
              end;
             _with_statement:=nil;
           end;
+         Must_be_valid:=Store_valid;
       end;
 
 
@@ -694,10 +697,6 @@ unit pstatmnt;
                 Message(parser_e_exit_with_argument_not__possible);
               if procinfo^.retdef=pdef(voiddef) then
                 Message(parser_e_void_function);
-              {
-              else
-                procinfo^.funcret_is_valid:=true;
-              }
            end
          else
            p:=nil;
@@ -826,7 +825,7 @@ unit pstatmnt;
           p,p2 : ptree;
           ht : ttoken;
           again : boolean; { dummy for do_proc_call }
-          destrukname : stringid;
+          {destrukname : stringid;}
           sym : psym;
           classh : pobjectdef;
           pd,pd2 : pdef;
@@ -868,7 +867,7 @@ unit pstatmnt;
                    { extended syntax of new and dispose }
                    { function styled new is handled in factor }
                    { destructors have no parameters }
-                   destrukname:=pattern;
+                   {destrukname:=pattern;}
                    destructorpos:=tokenpos;
                    consume(_ID);
 
@@ -1329,7 +1328,10 @@ unit pstatmnt;
 end.
 {
   $Log$
-  Revision 1.109  1999-11-15 22:00:48  peter
+  Revision 1.110  1999-11-17 17:05:02  pierre
+   * Notes/hints changes
+
+  Revision 1.109  1999/11/15 22:00:48  peter
     * labels used but not defined give error instead of warning, the warning
       is now only with declared but not defined and not used.
 

+ 37 - 6
compiler/psub.pas

@@ -650,6 +650,30 @@ begin
 end;
 
 
+procedure pd_pascal(const procnames:Tstringcontainer);
+var st,parast : psymtable;
+    lastps,ps : psym;
+begin
+   new(st,init(parasymtable));
+   parast:=aktprocsym^.definition^.parast;
+   lastps:=nil;
+   while assigned(parast^.symindex^.first) and (lastps<>psym(parast^.symindex^.first)) do
+     begin
+       ps:=psym(parast^.symindex^.first);
+       while assigned(ps^.next) and (psym(ps^.next)<>lastps) do
+         ps:=psym(ps^.next);
+       ps^.owner:=st;
+       { recalculate the corrected offset }
+       { the really_insert_in_data procedure
+         for parasymtable should only calculateoffset PM }
+       ps^.insert_in_data;
+       { reset the owner correctly }
+       ps^.owner:=parast;
+       lastps:=ps;
+     end;
+end;
+
+
 procedure pd_register(const procnames:Tstringcontainer);
 begin
   Message(parser_w_proc_register_ignored);
@@ -743,8 +767,8 @@ end;
   {$F-}
 {$endif}
 
-const
-   namelength=15;
+{const
+   namelength=15;}
 type
    pd_handler=procedure(const procnames:Tstringcontainer);
    proc_dir_rec=record
@@ -927,7 +951,7 @@ const
     ),(
       idtok:_PASCAL;
       pd_flags : pd_implemen+pd_body+pd_procvar;
-      handler  : nil;
+      handler  : {$ifndef TP}@{$endif}pd_pascal;
       pocall   : [pocall_leftright];
       pooption : [];
       mutexclpocall : [pocall_internproc];
@@ -1740,8 +1764,11 @@ begin
            vs^.varspez:=varspez;
            aktprocsym^.definition^.localst^.insert(vs);
            vs^.islocalcopy:=true;
-           vs^.varstate:=vs_used;
+           vs^.varstate:=vs_assigned;
            localvarsym:=vs;
+           inc(refs); { the para was used to set the local copy ! }
+           { warnings only on local copy ! }
+           varstate:=vs_used;
          end
         else
          begin
@@ -1782,7 +1809,8 @@ begin
       flags:=0;
     { standard frame pointer }
       framepointer:=frame_pointer;
-      funcret_is_valid:=false;
+      { funcret_is_valid:=false; }
+      funcret_state:=vs_declared;
     { is this a nested function of a method ? }
       if assigned(oldprocinfo) then
         _class:=oldprocinfo^._class;
@@ -1909,7 +1937,10 @@ end.
 
 {
   $Log$
-  Revision 1.34  1999-11-10 00:24:02  pierre
+  Revision 1.35  1999-11-17 17:05:02  pierre
+   * Notes/hints changes
+
+  Revision 1.34  1999/11/10 00:24:02  pierre
    * more browser details
 
   Revision 1.33  1999/11/09 23:43:08  pierre

+ 6 - 3
compiler/ptype.pas

@@ -1273,7 +1273,7 @@ uses
         pt : ptree;
         hp1,p : pdef;
         aufdef : penumdef;
-        aufsym : penumsym;
+        {aufsym : penumsym;}
         ap : parraydef;
         s : stringid;
         l,v : longint;
@@ -1445,7 +1445,7 @@ uses
                  consume(_LKLAMMER);
                  { allow negativ value_str }
                  l:=-1;
-                 aufsym := Nil;
+                 {aufsym := Nil;}
                  aufdef:=new(penumdef,init);
                  repeat
                    s:=pattern;
@@ -1608,7 +1608,10 @@ uses
 end.
 {
   $Log$
-  Revision 1.9  1999-11-11 00:56:54  pierre
+  Revision 1.10  1999-11-17 17:05:03  pierre
+   * Notes/hints changes
+
+  Revision 1.9  1999/11/11 00:56:54  pierre
    * Enum element reference location corrected
 
   Revision 1.8  1999/11/09 23:43:09  pierre

+ 8 - 5
compiler/ra386att.pas

@@ -59,7 +59,7 @@ type
    {------------------ Assembler Operators  --------------------}
    AS_MOD,AS_SHL,AS_SHR,AS_NOT,AS_AND,AS_OR,AS_XOR,AS_NOR);
 
-   tasmkeyword = string[8];
+   tasmkeyword = string[10];
 
 const
    { These tokens should be modified accordingly to the modifications }
@@ -71,7 +71,7 @@ const
    _count_asmspecialops = 25;
    _count_asmoverrides  = 3;
 
-  token2str : array[tasmtoken] of string[10]=(
+  token2str : array[tasmtoken] of tasmkeyword=(
     '','Label','LLabel','string','integer',
     'float',',','(',
     ')',':','.','+','-','*',
@@ -85,7 +85,7 @@ const
 const
   newline = #10;
   firsttoken : boolean = TRUE;
-  charcount  : byte = 0;
+{  charcount  : byte = 0;}
 var
   _asmsorted,
   inexpression   : boolean;
@@ -1748,7 +1748,7 @@ Begin
   if assigned(procinfo^.retdef) and
      (is_fpu(procinfo^.retdef) or
      ret_in_acc(procinfo^.retdef)) then
-    procinfo^.funcret_is_valid:=true;
+    procinfo^.funcret_state:=vs_assigned;
   { sets up all opcode and register tables in uppercase }
   if not _asmsorted then
    Begin
@@ -1992,7 +1992,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.62  1999-11-09 23:06:46  peter
+  Revision 1.63  1999-11-17 17:05:03  pierre
+   * Notes/hints changes
+
+  Revision 1.62  1999/11/09 23:06:46  peter
     * esi_offset -> selfpointer_offset to be newcg compatible
     * hcogegen -> cgbase fixes for newcg
 

+ 8 - 5
compiler/ra386dir.pas

@@ -72,7 +72,7 @@ unit Ra386dir;
             { consider it set function set if the offset was loaded }
            if assigned(procinfo^.retdef) and
               (pos(retstr,upper(s))>0) then
-              procinfo^.funcret_is_valid:=true;
+              procinfo^.funcret_state:=vs_assigned;
            s:='';
          end;
 
@@ -81,7 +81,7 @@ unit Ra386dir;
        s:='';
        if assigned(procinfo^.retdef) and
           is_fpu(procinfo^.retdef) then
-         procinfo^.funcret_is_valid:=true;
+         procinfo^.funcret_state:=vs_assigned;
        if assigned(procinfo^.retdef) and
           (procinfo^.retdef<>pdef(voiddef)) then
          retstr:=upper(tostr(procinfo^.retoffset)+'('+att_reg2str[procinfo^.framepointer]+')')
@@ -144,7 +144,7 @@ unit Ra386dir;
                                     ret_in_acc(procinfo^.retdef) and
                                     ((pos('AX',upper(hs))>0) or
                                     (pos('AL',upper(hs))>0)) then
-                                   procinfo^.funcret_is_valid:=true;
+                                   procinfo^.funcret_state:=vs_assigned;
                                  if (s[length(s)]<>'%') and
                                    (s[length(s)]<>'$') and
                                    ((s[length(s)]<>'0') or (hs[1]<>'x')) then
@@ -266,7 +266,7 @@ unit Ra386dir;
                    end;
  '{',';',#10,#13 : begin
                       if pos(retstr,s) > 0 then
-                        procinfo^.funcret_is_valid:=true;
+                        procinfo^.funcret_state:=vs_assigned;
                      writeasmline;
                      c:=current_scanner^.asmgetchar;
                    end;
@@ -295,7 +295,10 @@ unit Ra386dir;
 end.
 {
   $Log$
-  Revision 1.26  1999-11-09 23:06:46  peter
+  Revision 1.27  1999-11-17 17:05:03  pierre
+   * Notes/hints changes
+
+  Revision 1.26  1999/11/09 23:06:46  peter
     * esi_offset -> selfpointer_offset to be newcg compatible
     * hcogegen -> cgbase fixes for newcg
 

+ 6 - 3
compiler/ra386int.pas

@@ -38,7 +38,7 @@ Implementation
 Uses
   globtype,
   strings,cobjects,systems,verbose,globals,
-  files,aasm,types,scanner,symtable,cpubase,
+  files,aasm,types,scanner,symconst,symtable,cpubase,
 {$ifdef NEWCG}
   cgbase,
 {$else}
@@ -1656,7 +1656,7 @@ Begin
   if assigned(procinfo^.retdef) and
      (is_fpu(procinfo^.retdef) or
      ret_in_acc(procinfo^.retdef)) then
-    procinfo^.funcret_is_valid:=true;
+    procinfo^.funcret_state:=vs_assigned;
  { sets up all opcode and register tables in uppercase }
   if not _asmsorted then
    Begin
@@ -1772,7 +1772,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.52  1999-11-09 23:06:46  peter
+  Revision 1.53  1999-11-17 17:05:03  pierre
+   * Notes/hints changes
+
+  Revision 1.52  1999/11/09 23:06:46  peter
     * esi_offset -> selfpointer_offset to be newcg compatible
     * hcogegen -> cgbase fixes for newcg
 

+ 5 - 2
compiler/rautils.pas

@@ -683,7 +683,7 @@ Begin
      opr.ref.offset:=procinfo^.retoffset;
      opr.ref.base:= procinfo^.framepointer;
      { always assume that the result is valid. }
-     procinfo^.funcret_is_valid:=true;
+     procinfo^.funcret_state:=vs_assigned;
      SetupResult:=true;
    end
   else
@@ -1438,7 +1438,10 @@ end;
 end.
 {
   $Log$
-  Revision 1.29  1999-11-09 23:06:46  peter
+  Revision 1.30  1999-11-17 17:05:04  pierre
+   * Notes/hints changes
+
+  Revision 1.29  1999/11/09 23:06:46  peter
     * esi_offset -> selfpointer_offset to be newcg compatible
     * hcogegen -> cgbase fixes for newcg
 

+ 25 - 2
compiler/symconst.pas

@@ -159,9 +159,22 @@ type
   );
   tvaroptions=set of tvaroption;
 
+  { definition contains the informations about a type }
+  tdeftype = (abstractdef,arraydef,recorddef,pointerdef,orddef,
+              stringdef,enumdef,procdef,objectdef,errordef,
+              filedef,formaldef,setdef,procvardef,floatdef,
+              classrefdef,forwarddef);
+
+  { possible types for symtable entries }
+  tsymtyp = (abstractsym,varsym,typesym,procsym,unitsym,programsym,
+             constsym,enumsym,typedconstsym,errorsym,syssym,
+             labelsym,absolutesym,propertysym,funcretsym,
+             macrosym);
+
   { State of the variable, if it's declared, assigned or used }
   tvarstate=(vs_none,
-    vs_declared,vs_declared2,vs_assigned,vs_used
+    vs_declared,vs_declared_and_first_found,
+    vs_set_but_first_not_passed,vs_assigned,vs_used
   );
 
 const
@@ -176,12 +189,22 @@ const
     po_exports
   ];
 
+const
+     SymTypeName : array[tsymtyp] of string[12] =
+     ('abstractsym','variable','type','proc','unit','program',
+      'const','enum','typed const','errorsym','system sym',
+      'label','absolute','property','funcret',
+      'macrosym');
+
 implementation
 
 end.
 {
   $Log$
-  Revision 1.5  1999-11-07 23:16:49  florian
+  Revision 1.6  1999-11-17 17:05:04  pierre
+   * Notes/hints changes
+
+  Revision 1.5  1999/11/07 23:16:49  florian
     * finally bug 517 solved ...
 
   Revision 1.4  1999/10/26 12:30:45  peter

+ 4 - 7
compiler/symdefh.inc

@@ -24,12 +24,6 @@
                     TDef
 ************************************************}
 
-       { definition contains the informations about a type }
-       tdeftype = (abstractdef,arraydef,recorddef,pointerdef,orddef,
-                   stringdef,enumdef,procdef,objectdef,errordef,
-                   filedef,formaldef,setdef,procvardef,floatdef,
-                   classrefdef,forwarddef);
-
        pdef = ^tdef;
        tdef = object(tsymtableentry)
           deftype   : tdeftype;
@@ -531,7 +525,10 @@
 
 {
   $Log$
-  Revision 1.46  1999-11-09 23:35:50  pierre
+  Revision 1.47  1999-11-17 17:05:04  pierre
+   * Notes/hints changes
+
+  Revision 1.46  1999/11/09 23:35:50  pierre
    + better reference pos for forward defs
 
   Revision 1.45  1999/11/06 14:34:27  peter

+ 7 - 5
compiler/symppu.inc

@@ -536,13 +536,12 @@
            was_defined_at_startup:=boolean(current_ppu^.getbyte);
            was_used:=boolean(current_ppu^.getbyte);
            mac:=pmacrosym(macros^.search(hs));
-           if assigned(mac)
+           if assigned(mac) then
+             begin
 {$ifndef EXTDEBUG}
            { if we don't have the sources why tell }
-             and current_module^.sources_avail
+              if current_module^.sources_avail then
 {$endif ndef EXTDEBUG}
-             then
-             begin
                if not was_defined_at_startup and was_used and
                  mac^.defined_at_startup then
                  Comment(V_Hint,'Conditional '+hs+' was not set at startup '+
@@ -756,7 +755,10 @@
 
 {
   $Log$
-  Revision 1.54  1999-11-12 11:03:50  peter
+  Revision 1.55  1999-11-17 17:05:04  pierre
+   * Notes/hints changes
+
+  Revision 1.54  1999/11/12 11:03:50  peter
     * searchpaths changed to stringqueue object
 
   Revision 1.53  1999/11/06 14:34:27  peter

+ 47 - 1
compiler/symsym.inc

@@ -34,6 +34,7 @@
 {$endif GDB}
          fileinfo:=tokenpos;
          defref:=nil;
+         refs:=0;
          lastwritten:=nil;
          refcount:=0;
          if (cs_browser in aktmoduleswitches) and make_ref then
@@ -55,6 +56,7 @@
          readposinfo(fileinfo);
          lastref:=nil;
          defref:=nil;
+         refs:=0;
          lastwritten:=nil;
          refcount:=0;
 {$ifdef GDB}
@@ -426,6 +428,46 @@
            end;
       end;
 
+    procedure tprocsym.order_overloaded;
+      var firstdef,currdef,lastdef : pprocdef;
+      begin
+         firstdef:=definition;
+         currdef:=definition;
+         while assigned(currdef) do
+           begin
+             currdef^.count:=false;
+             currdef:=currdef^.nextoverloaded;
+           end;
+         definition:=definition^.nextoverloaded;
+         firstdef^.nextoverloaded:=nil;
+         while assigned(definition) do
+           begin
+             currdef:=firstdef;
+             lastdef:=definition;
+             definition:=definition^.nextoverloaded;
+             if lastdef^.mangledname>currdef^.mangledname then
+               begin
+                 lastdef^.nextoverloaded:=firstdef;
+                 firstdef:=lastdef;
+               end
+             else
+               begin
+                 while assigned(currdef^.nextoverloaded) and
+                    (currdef^.mangledname>lastdef^.mangledname) do
+                   currdef:=currdef^.nextoverloaded;
+                 lastdef^.nextoverloaded:=currdef^.nextoverloaded;
+                 currdef^.nextoverloaded:=lastdef;
+               end;
+           end;
+         definition:=firstdef;
+         currdef:=definition;
+         while assigned(currdef) do
+           begin
+             currdef^.count:=true;
+             currdef:=currdef^.nextoverloaded;
+           end;
+      end;
+
     procedure tprocsym.write;
       begin
          tsym.write;
@@ -1368,6 +1410,7 @@
                    { here we need the size of a push instead of the
                      size of the data }
                    l:=getpushsize;
+                   varstate:=vs_assigned;
                    address:=owner^.datasize;
                    owner^.datasize:=align(owner^.datasize+l,target_os.stackalignment);
                  end
@@ -2145,7 +2188,10 @@
 
 {
   $Log$
-  Revision 1.126  1999-11-15 22:00:48  peter
+  Revision 1.127  1999-11-17 17:05:04  pierre
+   * Notes/hints changes
+
+  Revision 1.126  1999/11/15 22:00:48  peter
     * labels used but not defined give error instead of warning, the warning
       is now only with declared but not defined and not used.
 

+ 6 - 9
compiler/symsymh.inc

@@ -24,12 +24,6 @@
                    TSym
 ************************************************}
 
-       { possible types for symtable entries }
-       tsymtyp = (abstractsym,varsym,typesym,procsym,unitsym,programsym,
-                  constsym,enumsym,typedconstsym,errorsym,syssym,
-                  labelsym,absolutesym,propertysym,funcretsym,
-                  macrosym);
-
        { this object is the base for all symbol objects }
        psym = ^tsym;
        tsym = object(tsymtableentry)
@@ -39,6 +33,7 @@
 {$ifdef GDB}
           isstabwritten : boolean;
 {$endif GDB}
+          refs          : longint;
           lastref,
           defref,
           lastwritten : pref;
@@ -77,7 +72,6 @@
        tunitsym = object(tsym)
           unitsymtable : punitsymtable;
           prevsym      : punitsym;
-          refs         : longint;
           constructor init(const n : string;ref : punitsymtable);
           constructor load;
           destructor done;virtual;
@@ -122,6 +116,7 @@
           { tests, if all procedures definitions are defined and not }
           { only forward                                             }
           procedure check_forward;
+          procedure order_overloaded;
           procedure write;virtual;
           procedure deref;virtual;
           procedure load_references;virtual;
@@ -164,7 +159,6 @@
           islocalcopy   : boolean;
           definition    : pdef;
           definitionsym : ptypesym;
-          refs          : longint;
           varoptions    : tvaroptions;
           reg           : tregister; { if reg<>R_NO, then the variable is an register variable }
           varspez       : tvarspez;  { sets the type of access }
@@ -329,7 +323,10 @@
 
 {
   $Log$
-  Revision 1.39  1999-11-15 22:00:48  peter
+  Revision 1.40  1999-11-17 17:05:06  pierre
+   * Notes/hints changes
+
+  Revision 1.39  1999/11/15 22:00:48  peter
     * labels used but not defined give error instead of warning, the warning
       is now only with declared but not defined and not used.
 

+ 47 - 3
compiler/symtable.pas

@@ -872,21 +872,49 @@ implementation
       begin
          if (psym(p)^.typ=varsym) and
             ((psym(p)^.owner^.symtabletype in [parasymtable,localsymtable,staticsymtable])) then
+          begin
            { unused symbol should be reported only if no }
            { error is reported                     }
            { if the symbol is in a register it is used   }
            { also don't count the value parameters which have local copies }
            { also don't claim for high param of open parameters (PM) }
+           if (Errorcount<>0) then
+             exit;
            if (pvarsym(p)^.refs=0) and
-              (Errorcount=0) and
               (copy(p^.name,1,3)<>'val') and
               (copy(p^.name,1,4)<>'high') then
              begin
                 if (psym(p)^.owner^.symtabletype=parasymtable) or pvarsym(p)^.islocalcopy then
-                  MessagePos1(psym(p)^.fileinfo,sym_h_para_identifier_not_used,p^.name)
+                  begin
+                    MessagePos1(psym(p)^.fileinfo,sym_h_para_identifier_not_used,p^.name);
+                  end
                 else
                   MessagePos1(psym(p)^.fileinfo,sym_n_local_identifier_not_used,p^.name);
+             end
+           else if pvarsym(p)^.varstate=vs_assigned then
+             begin
+                if (psym(p)^.owner^.symtabletype=parasymtable) then
+                  begin
+                    if (pvarsym(p)^.varspez<>vs_var)  then
+                      MessagePos1(psym(p)^.fileinfo,sym_h_para_identifier_only_set,p^.name)
+                  end
+                else if pvarsym(p)^.islocalcopy then
+                  begin
+                    if (pvarsym(p)^.varspez<>vs_var) then
+                      MessagePos1(psym(p)^.fileinfo,sym_h_para_identifier_only_set,p^.name);
+                  end
+                else if (psym(p)^.owner^.symtabletype<>parasymtable) then
+                  MessagePos1(psym(p)^.fileinfo,sym_n_local_identifier_only_set,p^.name);
              end;
+         end
+      else if ((psym(p)^.owner^.symtabletype in [parasymtable,localsymtable,staticsymtable])) then
+          begin
+           if (Errorcount<>0) then
+             exit;
+           { units references are problematic }
+           if (psym(p)^.refs=0) and not(psym(p)^.typ in [funcretsym,enumsym,unitsym]) then
+             MessagePos2(psym(p)^.fileinfo,sym_h_local_symbol_not_used,SymTypeName[psym(p)^.typ],p^.name);
+          end;
       end;
 
 {$ifdef GDB}
@@ -1109,6 +1137,12 @@ implementation
       end;
 
 
+    procedure order_overloads(p : Pnamedindexobject);
+      begin
+         if psym(p)^.typ=procsym then
+           pprocsym(p)^.order_overloaded;
+      end;
+
     procedure tsymtable.foreach(proc2call : tnamedindexcallback);
       begin
         symindex^.foreach(proc2call);
@@ -1316,6 +1350,7 @@ implementation
     procedure tsymtable.write;
       begin
       { write definitions }
+         foreach({$ifndef TP}@{$endif}Order_overloads);
          writedefs;
       { write symbols }
          writesyms;
@@ -1409,6 +1444,8 @@ implementation
            end;
          if (symtabletype in [recordsymtable,objectsymtable]) then
          current_ppu^.entrytyp:=subentryid;
+      { order procsym overloads }
+         foreach({$ifndef TP}@{$endif}Order_overloads);
          { write definitions }
          writedefs;
          { write symbols }
@@ -1633,6 +1670,10 @@ implementation
                   hp^.lastref:=newref;
                 inc(hp^.refcount);
              end;
+           if assigned(hp) and make_ref then
+             begin
+               inc(hp^.refs);
+             end;
          end;
         speedsearch:=hp;
       end;
@@ -2492,7 +2533,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.62  1999-11-15 22:00:48  peter
+  Revision 1.63  1999-11-17 17:05:06  pierre
+   * Notes/hints changes
+
+  Revision 1.62  1999/11/15 22:00:48  peter
     * labels used but not defined give error instead of warning, the warning
       is now only with declared but not defined and not used.
 

+ 5 - 1
compiler/tcadd.pas

@@ -190,6 +190,7 @@ implementation
                 end
               else
                 begin
+                   inc(t^.symtableprocentry^.refs);
                    t^.left:=gencallparanode(p^.left,nil);
                    t^.left:=gencallparanode(p^.right,t^.left);
                    if p^.treetype=unequaln then
@@ -1158,7 +1159,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.54  1999-11-16 23:45:28  pierre
+  Revision 1.55  1999-11-17 17:05:06  pierre
+   * Notes/hints changes
+
+  Revision 1.54  1999/11/16 23:45:28  pierre
    * global var token was changed by overload code (form bug 707)
 
   Revision 1.53  1999/11/15 21:53:42  peter

+ 17 - 8
compiler/tccal.pas

@@ -176,8 +176,8 @@ implementation
               if count_ref then
                begin
                  { not completly proper, but avoids some warnings }
-                 if (p^.left^.treetype=funcretn) and (defcoll^.paratyp=vs_var) then
-                   procinfo^.funcret_is_valid:=true;
+                 if (defcoll^.paratyp=vs_var) then
+                   set_funcret_is_valid(p^.left);
 
                  store_valid:=must_be_valid;
                  { protected has nothing to do with read/write
@@ -187,12 +187,16 @@ implementation
                  must_be_valid:=(defcoll^.paratyp<>vs_var);
                  { only process typeconvn and arrayconstructn, else it will
                    break other trees }
+                 { But this is need to get correct varstate !! PM }
                  old_array_constructor:=allow_array_constructor;
                  old_get_para_resulttype:=get_para_resulttype;
                  allow_array_constructor:=true;
                  get_para_resulttype:=false;
-                 if (p^.left^.treetype in [arrayconstructn,typeconvn]) then
+                 { if (p^.left^.treetype in [arrayconstructn,typeconvn]) or
+                    not assigned(p^.resulttype) then  }
                    firstpass(p^.left);
+                 if not assigned(p^.resulttype) then
+                   p^.resulttype:=p^.left^.resulttype;
                  get_para_resulttype:=old_get_para_resulttype;
                  allow_array_constructor:=old_array_constructor;
                  must_be_valid:=store_valid;
@@ -494,7 +498,9 @@ implementation
                    if codegenerror then
                      goto errorexit;
                 end;
+              must_be_valid:=true;
               firstpass(p^.right);
+              must_be_valid:=false;
 
               { check the parameters }
               pdc:=pparaitem(pprocvardef(p^.right^.resulttype)^.para^.first);
@@ -521,6 +527,7 @@ implementation
                      goto errorexit;
                 end;
               p^.resulttype:=pprocvardef(p^.right^.resulttype)^.retdef;
+
               { this was missing, leads to a bug below if
                 the procvar is a function }
               p^.procdefinition:=pabstractprocdef(p^.right^.resulttype);
@@ -546,7 +553,6 @@ implementation
                 end;
 
               aktcallprocsym:=pprocsym(p^.symtableprocentry);
-
               { do we know the procedure to call ? }
               if not(assigned(p^.procdefinition)) then
                 begin
@@ -1156,12 +1162,12 @@ implementation
                      if (p^.procdefinition^.proctypeoption=potype_constructor) or
                         ((p^.methodpointer^.treetype=loadn) and
                         (not(oo_has_virtual in pobjectdef(p^.methodpointer^.resulttype)^.objectoptions))) then
-                       must_be_valid:=false;
-                     {
+                       must_be_valid:=false
                      else
                        must_be_valid:=true;
-                     }
+                     count_ref:=true;
                      firstpass(p^.methodpointer);
+                     must_be_valid:=store_valid;
                      p^.registersfpu:=max(p^.methodpointer^.registersfpu,p^.registersfpu);
                      p^.registers32:=max(p^.methodpointer^.registers32,p^.registers32);
 {$ifdef SUPPORT_MMX}
@@ -1221,7 +1227,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.71  1999-11-06 14:34:29  peter
+  Revision 1.72  1999-11-17 17:05:07  pierre
+   * Notes/hints changes
+
+  Revision 1.71  1999/11/06 14:34:29  peter
     * truncated log to 20 revs
 
   Revision 1.70  1999/10/26 12:30:46  peter

+ 23 - 15
compiler/tcflw.pas

@@ -44,7 +44,7 @@ implementation
     uses
       globtype,systems,
       cobjects,verbose,globals,
-      symtable,aasm,types,
+      symconst,symtable,aasm,types,
       hcodegen,htypechk,temp_gen,pass_1,cpubase
 {$ifdef i386}
       ,tgeni386
@@ -236,6 +236,16 @@ implementation
          old_t_times:=t_times;
          if not(cs_littlesize in aktglobalswitches) then
            t_times:=t_times*8;
+         { save counter var }
+         p^.t2:=getcopy(p^.left^.left);
+
+         if p^.left^.treetype<>assignn then
+           CGMessage(cg_e_illegal_expression);
+
+         cleartempgen;
+         must_be_valid:=false;
+         firstpass(p^.left);
+
          cleartempgen;
          if assigned(p^.t1) then
           begin
@@ -243,22 +253,12 @@ implementation
             if codegenerror then
              exit;
           end;
-         { save counter var }
-         p^.t2:=getcopy(p^.left^.left);
 
          p^.registers32:=p^.t1^.registers32;
          p^.registersfpu:=p^.t1^.registersfpu;
 {$ifdef SUPPORT_MMX}
          p^.registersmmx:=p^.left^.registersmmx;
 {$endif SUPPORT_MMX}
-
-         if p^.left^.treetype<>assignn then
-           CGMessage(cg_e_illegal_expression);
-
-         cleartempgen;
-         must_be_valid:=false;
-         firstpass(p^.left);
-         must_be_valid:=true;
          if p^.left^.registers32>p^.registers32 then
            p^.registers32:=p^.left^.registers32;
          if p^.left^.registersfpu>p^.registersfpu then
@@ -269,6 +269,7 @@ implementation
 {$endif SUPPORT_MMX}
 
          { process count var }
+         must_be_valid:=true;
          cleartempgen;
          firstpass(p^.t2);
          if codegenerror then
@@ -281,8 +282,12 @@ implementation
          if (hp^.treetype<>loadn) then
           CGMessage(cg_e_illegal_count_var)
          else
-          if (not(is_ordinal(p^.t2^.resulttype)) or is_64bitint(p^.t2^.resulttype)) then
-           CGMessage(type_e_ordinal_expr_expected);
+          begin
+            if hp^.symtableentry^.typ=varsym then
+              pvarsym(hp^.symtableentry)^.varstate:=vs_used;
+            if (not(is_ordinal(p^.t2^.resulttype)) or is_64bitint(p^.t2^.resulttype)) then
+              CGMessage(type_e_ordinal_expr_expected);
+          end;
 
          if p^.t2^.registers32>p^.registers32 then
            p^.registers32:=p^.t2^.registers32;
@@ -328,7 +333,7 @@ implementation
          if assigned(p^.left) then
            begin
               firstpass(p^.left);
-              procinfo^.funcret_is_valid:=true;
+              procinfo^.funcret_state:=vs_assigned;
               if codegenerror then
                exit;
               { Check the 2 types }
@@ -507,7 +512,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.24  1999-11-06 14:34:30  peter
+  Revision 1.25  1999-11-17 17:05:07  pierre
+   * Notes/hints changes
+
+  Revision 1.24  1999/11/06 14:34:30  peter
     * truncated log to 20 revs
 
   Revision 1.23  1999/10/05 22:01:53  pierre

+ 23 - 9
compiler/tcinl.pas

@@ -129,8 +129,9 @@ implementation
              (pfloatdef(p^.left^.resulttype)^.typ<>s80real) then
              begin
                 p^.left:=gentypeconvnode(p^.left,s80floatdef);
-                firstpass(p^.left);
              end;
+           { redo firstpass for varstate status PM }
+           firstpass(p^.left);
            p^.registers32:=p^.left^.registers32;
            p^.registersfpu:=p^.left^.registersfpu;
 {$ifdef SUPPORT_MMX}
@@ -158,6 +159,7 @@ implementation
               left_right_max(p);
               set_location(p^.location,p^.left^.location);
            end;
+         count_ref:=true;
          { handle intern constant functions in separate case }
          if p^.inlineconst then
           begin
@@ -578,6 +580,7 @@ implementation
                  p^.resulttype:=voiddef;
                  if assigned(p^.left) then
                    begin
+                      p^.left^.resulttype:=nil;
                       firstcallparan(p^.left,nil);
                       if codegenerror then
                        exit;
@@ -633,6 +636,7 @@ implementation
                   if assigned(p^.left) then
                     begin
                        dowrite:=(p^.inlinenumber in [in_write_x,in_writeln_x]);
+                       p^.left^.resulttype:=nil;
                        firstcallparan(p^.left,nil);
                        { now we can check }
                        hp:=p^.left;
@@ -786,6 +790,7 @@ implementation
                        if codegenerror then
                          exit;
                        must_be_valid:=true;
+                       p^.left^.resulttype:=nil;
                        firstcallparan(p^.left,nil);
                        { calc registers }
                        left_right_max(p);
@@ -839,12 +844,14 @@ implementation
                   must_be_valid:=false;
                   count_ref:=true;
                   p^.left^.right:=nil;
+                  p^.left^.resulttype:=nil;
                   firstcallparan(p^.left,nil);
                   { remove warning when result is passed }
-                  if (p^.left^.left^.treetype=funcretn) then
-                   procinfo^.funcret_is_valid:=true;
+                  set_funcret_is_valid(p^.left^.left);
                   must_be_valid:=true;
                   p^.left^.right:=hp;
+                  { force second parsing }
+                  hp^.resulttype:=nil;
                   firstcallparan(p^.left^.right,nil);
                   hp:=p^.left;
                   { valid string ? }
@@ -919,6 +926,7 @@ implementation
                   if codegenerror then
                     exit;
                   must_be_valid:=true;
+                  p^.left^.resulttype:=nil;
                   firstcallparan(p^.left,nil);
                   { calc registers }
                   left_right_max(p);
@@ -944,6 +952,7 @@ implementation
                        must_be_valid := false;
                        count_ref := true;
                        make_not_regable(p^.left^.left);
+                       p^.left^.resulttype:=nil;
                        firstcallparan(p^.left, nil);
                        if codegenerror then exit;
                        p^.left^.right := hp;
@@ -966,12 +975,12 @@ implementation
                   hpp^.right:=nil;
                   {hpp = destination}
                   make_not_regable(hpp^.left);
+                  hpp^.resulttype:=nil;
                   firstcallparan(hpp,nil);
                   if codegenerror then
                     exit;
                   { remove warning when result is passed }
-                  if (hpp^.left^.treetype=funcretn) then
-                   procinfo^.funcret_is_valid:=true;
+                  set_funcret_is_valid(hpp^.left);
                   hpp^.right := hp;
                   if valid_for_assign(hpp^.left,false) then
                    begin
@@ -984,8 +993,9 @@ implementation
                    end;
                   must_be_valid:=true;
                  {hp = source (String)}
-                  count_ref := false;
+                  { count_ref := false; WHY ?? }
                   must_be_valid := true;
+                  hp^.resulttype:=nil;
                   firstcallparan(hp,nil);
                   if codegenerror then
                     exit;
@@ -1013,6 +1023,7 @@ implementation
                  p^.resulttype:=voiddef;
                  if assigned(p^.left) then
                    begin
+                      p^.left^.resulttype:=nil;
                       firstcallparan(p^.left,nil);
                       p^.registers32:=p^.left^.registers32;
                       p^.registersfpu:=p^.left^.registersfpu;
@@ -1020,8 +1031,7 @@ implementation
                       p^.registersmmx:=p^.left^.registersmmx;
 {$endif SUPPORT_MMX}
                       { remove warning when result is passed }
-                      if (p^.left^.left^.treetype=funcretn) then
-                       procinfo^.funcret_is_valid:=true;
+                      set_funcret_is_valid(p^.left^.left);
                       { first param must be var }
                       valid_for_assign(p^.left^.left,false);
                       { check type }
@@ -1225,6 +1235,7 @@ implementation
                  p^.resulttype:=voiddef;
                  if assigned(p^.left) then
                    begin
+                      p^.left^.resulttype:=nil;
                       firstcallparan(p^.left,nil);
                       p^.registers32:=p^.left^.registers32;
                       p^.registersfpu:=p^.left^.registersfpu;
@@ -1269,7 +1280,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.58  1999-11-06 14:34:30  peter
+  Revision 1.59  1999-11-17 17:05:07  pierre
+   * Notes/hints changes
+
+  Revision 1.58  1999/11/06 14:34:30  peter
     * truncated log to 20 revs
 
   Revision 1.57  1999/10/29 15:28:51  peter

+ 32 - 10
compiler/tcld.pas

@@ -150,7 +150,8 @@ implementation
 
                    if must_be_valid and p^.is_first then
                      begin
-                       if pvarsym(p^.symtableentry)^.varstate=vs_declared2 then
+                       if (pvarsym(p^.symtableentry)^.varstate=vs_declared_and_first_found) or
+                          (pvarsym(p^.symtableentry)^.varstate=vs_set_but_first_not_passed) then
                         if (assigned(pvarsym(p^.symtableentry)^.owner) and
                            assigned(aktprocsym) and
                            (pvarsym(p^.symtableentry)^.owner = aktprocsym^.definition^.localst)) then
@@ -165,9 +166,26 @@ implementation
                      begin
                         if (p^.is_first) then
                           begin
-                            if pvarsym(p^.symtableentry)^.varstate=vs_declared2 then
-                             pvarsym(p^.symtableentry)^.varstate:=vs_used;
+                            if pvarsym(p^.symtableentry)^.varstate=vs_declared_and_first_found then
+                            { this can only happen at left of an assignment, no ? PM }
+                             if (parsing_para_level=0) and not must_be_valid then
+                              pvarsym(p^.symtableentry)^.varstate:=vs_assigned
+                             else
+                              pvarsym(p^.symtableentry)^.varstate:=vs_used;
+                            if pvarsym(p^.symtableentry)^.varstate=vs_set_but_first_not_passed then
+                              pvarsym(p^.symtableentry)^.varstate:=vs_used;
                             p^.is_first:=false;
+                          end
+                        else
+                          begin
+                            if (pvarsym(p^.symtableentry)^.varstate=vs_assigned) and
+                               (must_be_valid or (parsing_para_level>0) or
+                                (p^.resulttype^.deftype=procvardef)) then
+                              pvarsym(p^.symtableentry)^.varstate:=vs_used;
+                            if (pvarsym(p^.symtableentry)^.varstate=vs_declared_and_first_found) and
+                               (must_be_valid or (parsing_para_level>0) or
+                               (p^.resulttype^.deftype=procvardef)) then
+                              pvarsym(p^.symtableentry)^.varstate:=vs_set_but_first_not_passed;
                           end;
                      end;
                      { this will create problem with local var set by
@@ -346,12 +364,13 @@ implementation
          { no claim if setting higher return value_str }
          if must_be_valid and
             (procinfo=pprocinfo(p^.funcretprocinfo)) and
-            not procinfo^.funcret_is_valid then
-           CGMessage(sym_w_function_result_not_set);
-         {
-         if count_ref then
-           pprocinfo(p^.funcretprocinfo)^.funcret_is_valid:=true;
-         }
+            ((procinfo^.funcret_state=vs_declared) or
+            (p^.is_first_funcret)) then
+           begin
+             CGMessage(sym_w_function_result_not_set);
+             { avoid multiple warnings }
+             procinfo^.funcret_state:=vs_assigned;
+           end;
       end;
 
 
@@ -502,7 +521,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.49  1999-11-06 14:34:30  peter
+  Revision 1.50  1999-11-17 17:05:07  pierre
+   * Notes/hints changes
+
+  Revision 1.49  1999/11/06 14:34:30  peter
     * truncated log to 20 revs
 
   Revision 1.48  1999/10/26 12:30:46  peter

+ 13 - 6
compiler/tcmem.pas

@@ -235,10 +235,6 @@ implementation
                    begin
                      hp:=genloadmethodcallnode(pprocsym(p^.left^.symtableprocentry),p^.left^.symtableproc,
                        getcopy(p^.left^.methodpointer));
-                     disposetree(p);
-                     firstpass(hp);
-                     p:=hp;
-                     exit;
                    end
                   else
                    hp:=genloadcallnode(pprocsym(p^.left^.symtableprocentry),p^.left^.symtableproc);
@@ -339,6 +335,7 @@ implementation
 {$endif SUPPORT_MMX}
          if p^.registers32<1 then
            p^.registers32:=1;
+         { is this right for object of methods ?? }
          p^.location.loc:=LOC_REGISTER;
       end;
 
@@ -378,8 +375,12 @@ implementation
 *****************************************************************************}
 
     procedure firstderef(var p : ptree);
+      var store_valid : boolean;
       begin
+         store_valid:=must_be_valid;
+         must_be_valid:=true;
          firstpass(p^.left);
+         must_be_valid:=store_valid;
          if codegenerror then
            begin
              p^.resulttype:=generrordef;
@@ -445,6 +446,7 @@ implementation
       var
          harr : pdef;
          ct : tconverttype;
+         store_valid : boolean;
 {$ifdef consteval}
          tcsym : ptypedconstsym;
 {$endif}
@@ -484,7 +486,10 @@ implementation
                 harr:=new(parraydef,init(0,$7fffffff,s32bitdef));
                 parraydef(harr)^.definition:=ppointerdef(p^.left^.resulttype)^.definition;
                 p^.left:=gentypeconvnode(p^.left,harr);
+                store_valid:=must_be_valid;
+                must_be_valid:=true;
                 firstpass(p^.left);
+                must_be_valid:=store_valid;
 
                 if codegenerror then
                   exit;
@@ -629,7 +634,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.32  1999-11-06 14:34:30  peter
+  Revision 1.33  1999-11-17 17:05:07  pierre
+   * Notes/hints changes
+
+  Revision 1.32  1999/11/06 14:34:30  peter
     * truncated log to 20 revs
 
   Revision 1.31  1999/10/26 12:30:46  peter
@@ -713,4 +721,3 @@ end.
     * procedure of object and addrn fixes
 
 }
-

+ 10 - 3
compiler/tree.pas

@@ -225,7 +225,8 @@ unit tree;
              ordconstn : (value : longint);
              realconstn : (value_real : bestreal;lab_real : pasmlabel);
              fixconstn : (value_fix: longint);
-             funcretn : (funcretprocinfo : pointer;retdef : pdef);
+             funcretn : (funcretprocinfo : pointer;retdef : pdef;
+                       is_first_funcret : boolean);
              subscriptn : (vs : pvarsym);
              vecn : (memindex,memseg:boolean;callunique : boolean);
              stringconstn : (value_str : pchar;length : longint; lab_str : pasmlabel;stringtype : tstringtype);
@@ -1645,7 +1646,10 @@ unit tree;
            begin
               case p^.treetype of
                  funcretn:
-                    procinfo^.funcret_is_valid:=true;
+                    begin
+                      if p^.is_first_funcret then
+                        pprocinfo(p^.funcretprocinfo)^.funcret_state:=vs_assigned;
+                    end;
                  vecn,typeconvn,subscriptn,derefn:
                     set_funcret_is_valid(p^.left);
               end;
@@ -1791,7 +1795,10 @@ unit tree;
 end.
 {
   $Log$
-  Revision 1.101  1999-11-06 14:34:31  peter
+  Revision 1.102  1999-11-17 17:05:07  pierre
+   * Notes/hints changes
+
+  Revision 1.101  1999/11/06 14:34:31  peter
     * truncated log to 20 revs
 
   Revision 1.100  1999/10/22 14:37:31  peter