Neolithic vxWorks (5.x?) is the only one I know, and I know that Dirk uses.
Andrew always fixed these situations in Base, but he stopped doing that. When APS moved to vxWorks 6? Around Bronze age?
The APS still builds and runs some IOCs on VxWorks 5.5.2 but we have been working to update those IOCs to Base-3.14.12.5 and VxWorks 6.9 which is quite happy to compile declarations after other statements in a block. I’m not sure which VxWorks 6.x version
updated gcc to one that first accepted that syntax, I’m pretty sure 6.8 also supports it though.
I did have to point out to Kay the other day that the latest release of his ether_ip module no longer builds on VxWorks 5 for this exact same reason, but I was able to disable those targets when building that module and I just suggested that he should
mention the incompatibility in his README, not that he should change the code.
EPICS 7.0 dropped support for VxWorks 5.5.x, but Dirk has previously submitted changes to ensure the core modules will build for it; it’s just the PVA modules that can’t. Does a newer gcc build that has the flag --std=c89 detect
this syntax? I suspect it might also need the flag —pedantic to enforce the old syntax standard though, and Base probably won’t build with that flag as well.
If someone is able to detect this by playing with with compiler flags they would also have to stop that build from descending into the PVA modules. That can be done quite easily by having the build create a
modules/Makefile.local that contains just one line:
Whether Ralph would/should accept the necessary parallel changes to the CI scripts is a different question though.
Dirk's particular change request here seems innocuous[1] and small enough that I don’t mind our making it. At some point though (7.1 if not sooner) we are going to reject these kinds of changes on principle. Variable scope affects code readability.
- Andrew
[1]
-
not harmful or offensive.
"it was an innocuous question"
On 11/20/20 12:49 AM, Zimoch Dirk (PSI) wrote:
> Which this change, the tests terminates and succeeds.
>
> Please do not have variable declarations after instructions in C (non C++) code. Not all compilers like that. I already had to fix udpSockFanoutTestRx() because of this problem:
How could we expand our CI coverage to discover this?
Do your CI builds cover this case? (a non-MS compiler
which still imposes this C89 ordering restriction by
default)
> @@ -213,6 +213,7 @@ void udpSockFanoutTestRx(void* raw)
> {
> struct TInfo *info = raw;
> epicsTimeStamp start, now;
> + unsigned nremain = nrepeat;
> #ifdef _WIN32
> /* ms */
> DWORD timeout = 10000;
> @@ -222,7 +223,6 @@ void udpSockFanoutTestRx(void* raw)
> timeout.tv_sec = 10;
> timeout.tv_usec = 0;
> #endif
> - unsigned nremain = nrepeat;
>
> (void)epicsTimeGetCurrent(&start);
> now = start;
>
>
>
> Dirk