Re: [hatari-devel] Some findings |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
]
- To: hatari-devel@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [hatari-devel] Some findings
- From: Thomas Huth <th.huth@xxxxxxxxx>
- Date: Tue, 4 Sep 2018 06:37:45 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1536035866; bh=duf/G2JYqHryPyMhy396QNvA6C0mjMJHn1Uj1xNkiXA=; h=Subject:To:From:Date:From; b=gj25ahw/nGj0WCrAneUibVkwkcXbfB+VskGheNz40LNEq3KH2xeeCnqTRBZ8dkQDI lQHPSfanURSgVGTxS3zXW85hiH/P0DlAbbohEAcH54qRjn9u6CkVPmcaOsW1zEYlNq tiwHmTig1u/QY7gkzlSpwrps1vDyXVS/Z0ufnOVrWHMRO4RxHXA/WRU7rNzxPPxX4o ySPtd5yInaAZ/+65BK4FSrnBmEP2d5inaLsAEwlyhyWCENfV7dtWW1UjbQv412TL7P rdLkkMgHLJj0GP38LhBTBTsHpkOpkwJydGkYDUYBCyn77lcel4w3vgSy1N807QY4QW iw5tnLhVkKuDA==
On 2018-09-03 18:51, Nicolas Pomarède wrote:
[...]
> Hi
>
> Can't tell the reason for Troed's build ,
I've had a look at the build.log, and it failed during linking, not
during compiling.
> but I fixed a "for loop" in
> nc5380.c that required c11 or c99 options in gcc :
>
> src/ncr5380.c:309:5: erreur: 'for' loop initial declarations are only
> allowed in C99 or C11 mode
> for (int i = 0; i < 8; i++) {
> ^
> src/ncr5380.c:309:5: note: use option -std=c99, -std=gnu99, -std=c11 or
> -std=gnu11 to compile your code
>
> gcc 4.9.2 is reporting this error, but the most recent gcc 8 doesn't
> report it anymore.
That's an issue indeed - and it happens almost each time we copy some
code from a C++ project to Hatari. The problem is that GCC switched the
default setting for -std, it used to be gnu89, but since GCC 5.1, it is
gnu11 instead.
> Since we want to keep C compatibility with older compilers, maybe we
> should explicitely add options to Cmake in order to report this also
> with more recent gcc ? Using the -std=option (but I don't know the
> equivalent that was used in gcc 4.9) ; else the compilation issue might
> go unnoticed as I guess most of us are compiling with recent gcc version.
I agree, we should set a value for -std in our CMakeLists.txt. The
question is: Which one? Do we want to enforce the old C syntax? Then we
should go with "-std=gnu89". Or are we fine allowing the newer syntax
now, too, especially with regards to the code that we copy from C++
projects? Then we should go with gnu99 or gnu11 instead. I personally
tend to use one of the last options to allow the newer syntax. Shall we
simply have a try with gnu11? It is marked as "incomplete" in GCC 4.x,
but at least for the "for"-loop initializers, it seems to work fine.
Thomas