Hi all,

Le 26/01/2022 à 02:59, Ryan Joseph via fpc-pascal a écrit :
I have this macro:

{$define TCallback := TCallback2}

which gives a long list of these errors.

warning: Expanding of macros exceeds a depth of 16.

What does this warning mean and how can I resolve it?

  I just tested this:

muller@gcc140:~/pas/check$ ./test-macro-expansion
TCallBack2 called
muller@gcc140:~/pas/check$ cat ./test-macro-expansion.pp

procedure TCallBack2;

begin
  writeln('TCallBack2 called');
end;

{$define TCallback := TCallback2}

begin
  TCallBack();
end.
muller@gcc140:~/pas/check$ fpc -Sm  test-macro-expansion.pp
Free Pascal Compiler version 3.2.2 [2021/05/16] for x86_64
Copyright (c) 1993-2021 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling test-macro-expansion.pp
Linking test-macro-expansion
12 lines compiled, 0.1 sec
muller@gcc140:~/pas/check$ ./test-macro-expansion
TCallBack2 called


So it is not as simple as Sven suggested...
Maybe there is another line like
 {$define TCallback2 := TCallback}

Indeed:
muller@gcc140:~/pas/check$ cat   ./test-double-macro-expansion.pp

procedure TCallBack2;

begin
  writeln('TCallBack2 called');
end;

{$define TCallback := TCallback2}
{$define TCallback2 := TCallback}

begin
  TCallBack();
end.
muller@gcc140:~/pas/check$ fpc  -Sm ./test-double-macro-expansion.pp
Free Pascal Compiler version 3.2.2 [2021/05/16] for x86_64
Copyright (c) 1993-2021 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling ./test-double-macro-expansion.pp
test-double-macro-expansion.pp(9,10) Warning: Expanding of macros exceeds a 
depth of 16.
test-double-macro-expansion.pp(9,10) Error: Identifier not found "TCallback"
test-double-macro-expansion.pp(14) Fatal: There were 1 errors compiling module, 
stopping
Fatal: Compilation aborted
Error: /home/muller/pas/x86_64/fpc-3.2.2/bin/ppcx64 returned an error exitcode


You should probably try to look for another define somewhere else!

Pierre

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to