![]() |
![]() |
#1 |
Semi-Retired
Join Date: Mar 2012
Location: Leiden / The Netherlands
Posts: 2,069
|
VBCC complaining about specifying registers in the function declaration
Hello,
In a project of mine which contains 68K parts and PPC (WarpOS parts) I recently observed that the compiler is complaining about when I assign certain registers to parameters. The project initially was compiled in 2021. I only updated the 68K parts since and I updated VBCC somewhere in 2022. So the PPC objects file were from 2021 still. Now recently, a recompile was triggered for the PPC parts and now I get all these warnings that were not there in 2021, so I guess something changed in an update of VBCC. The functions just assign the standard registers to the parameters, so first parameter = r3 2nd = r4 etc. I can no longer recall why I did that :-) but it didn't give warnings before. So something like: Code:
PPCFUNCTION VOID FreeVec68K(__reg("r3") struct PrivatePPCBase* PowerPCBase, __reg("r4") APTR memBlock) How do I fix this? |
![]() |
![]() |
#2 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,581
|
Hmm. It shouldn't. I cannot check your exact example, because I neither know
PPCFUNCTIONnor PrivatePPCBase, but the following simple test definitely works with the last release vbccppc: Code:
frank@nerthus cat tst.c void f(__reg("r3") void *x, __reg("r4") void *y) { } frank@nerthus vc +warpos -c tst.c frank@nerthus ll tst.o -rw-r--r-- 1 frank users 116 Jan 17 21:35 tst.o frank@nerthus vbccppc vbcc V0.9h (c) in 1995-2022 by Volker Barthelmann vbcc code-generator for PPC V0.7 (c) in 1997-2022 by Volker Barthelmann ![]() |
![]() |
![]() |
#3 |
Semi-Retired
Join Date: Mar 2012
Location: Leiden / The Netherlands
Posts: 2,069
|
https://github.com/Sakura-IT/PowerPC...r/supportppc.c
So the declarations in internalsppc.h do not have the __reg stuff in it. Not sure if that is the problem. PPCFUNCTION just puts the PPC stuff in its own section (internalsppc.h). PrivatePPCBase is just a wrapper for the WarpOS powerpc.library base with added stuff that my own powerpc.library uses (libstructs.h). Everything worked before.. I mean it still works...just 4 warnings for every function. |
![]() |
![]() |
#4 |
Semi-Retired
Join Date: Mar 2012
Location: Leiden / The Netherlands
Posts: 2,069
|
I am using 0.9h I see now. Warnings are 368, 68, 368 and 123 for each function
|
![]() |
![]() |
#5 | ||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,581
|
Quote:
Might look stupid in this case, because you specified the correct registers for the ABI, but I guess that the parameter check is done by some general code in the compiler core, which doesn't know the ABI. Quote:
Anyway, just write the function declaration the same way as the definition and you have no problems! ![]() |
||
![]() |
![]() |
#6 |
Semi-Retired
Join Date: Mar 2012
Location: Leiden / The Netherlands
Posts: 2,069
|
|
![]() |
![]() |
#7 | |
Semi-Retired
Join Date: Mar 2012
Location: Leiden / The Netherlands
Posts: 2,069
|
Quote:
Pfffff why did it work before? :-D Now I have to edit 200 function declarations. And some of them are used by the 68K side too, those are complaining now about unknown registers haha. Anyway, I have some puzzle to solve. Thanks! |
|
![]() |
![]() |
#8 | |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,581
|
Because a function with with a
__sectionattribute shouldn't match a previous function declaration without one? I guess that was something which needed improvement. ![]() It seemed like a good idea to warn about such differences. Although I would have to read the C-specs if it is really required. Quote:
__reg()s in the PPC code? Or do you have register arguments in the 68k code as well? In the worst case you can still write declarations for each cpu, separated by #ifdef __M68K__or __PPC__. |
|
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
out of registers | meynaf | Coders. Asm / Hardware | 45 | 30 August 2023 13:51 |
fd2pragma inline entry for function that returns pointer to another function | Sim085 | Coders. C/C++ | 11 | 02 March 2022 10:38 |
VBCC: Restrict usage of registers in C | Hedeon | Coders. C/C++ | 12 | 01 July 2020 11:42 |
Preservation of registers | guy lateur | Coders. Asm / Hardware | 51 | 26 October 2018 14:33 |
__builtin_ function link library for vbcc | matthey | Coders. C/C++ | 1 | 25 March 2016 23:28 |
|
|