vishapoberon / compiler

vishap oberon compiler
http://oberon.vishap.am
GNU General Public License v3.0
186 stars 25 forks source link

warning: implicit declaration of function #88

Open norayr opened 4 years ago

norayr commented 4 years ago
MODULE test;
CONST
  InitialSize = 64;

TYPE
  something* = POINTER TO RECORD
    length-: LONGINT; (* current length of string excluding 0X *)
    bufferSize: LONGINT; (* {bufferSize >= InitialSize} *)
    buffer : POINTER TO ARRAY OF CHAR;
  END;

PROCEDURE (this: something) Clear*;
BEGIN
  this.buffer[0] := 0X;
  this.length := 0
END Clear;

PROCEDURE (this: something) Init*;
BEGIN
  this.bufferSize := InitialSize;
  NEW(this.buffer, this.bufferSize);
  this.Clear
END Init;

END test.

when compiling we have a warning:

 $ /opt/voc/bin/voc -s test.Mod 
test.Mod  Compiling test.  818 chars.
test.c: In function ‘test_something_Init’:
test.c:37:2: warning: implicit declaration of function ‘__test_something_Clear’; did you mean ‘test_something_Clear’? [-Wimplicit-function-declaration]
   37 |  __test_something_Clear(this);
      |  ^~~~~~~~~~~~~~~~~~~~~~
      |  test_something_Clear

this is solvable by removing the OPM.WriteString call at line 863 in OPV.Mod

                       IF n^.left^.subcl = OPT.super THEN proc := SuperProc(n)
                       ELSE (*OPM.WriteString("__");*) proc := OPC.BaseTProc(n^.left^.obj)
                       END ;

There is other OPM.WriteString("__"); at line 631 of OPV.Mod, that handles different case, and doesn't affect this one.