Re: [hatari-devel] Patch for bits |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
]
- To: Hatari devel list <hatari-devel@xxxxxxxxxxxxxxxxxxx>
- Subject: Re: [hatari-devel] Patch for bits
- From: Andreas Grabher <andreas_g86@xxxxxxxxxx>
- Date: Sun, 14 Apr 2024 10:13:20 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1713082412; bh=vhM4/8sbAeUlQphCQZUSz7EjwT92RR7zfse9aH+V8Kg=; h=From:Content-Type:Mime-Version:Subject:Date:To:Message-Id; b=zZQx57j0dqQp4nG5Z6vSPsEOngMVJKxrr9p6cQ18T62ulfCLlNnyx2i1zKAWnaJ/q JJLLtpFytJ8pNw//J5AK/JAfM40+evLJLAd8mxlzBYPeiU8oH3gAXy8gVILUJAmLNn xjpzzSUZX/cn2UJ1QfM5WfVPR7Fz9iHT2Q+v3uBkyq1S3DTrW9kfB2XvgtHk2NiBU3 sSE2mto0hwOy6n66YrjY05nU727uQd01dZllyKLVQfqjDS1OZ8aBZd66bAJcgnoj/2 wJKzTMsK8l7taD6L/tvrARO/P5kxliHK0sWY727/5DV5GXIohL1H0Qf19WZQQtlOEU KKXaPpXEgmm+A==
> Am 14.04.2024 um 09:47 schrieb Nicolas Pomarède <npomarede@xxxxxxxxxxxx>:
>
> Le 14/04/2024 à 07:52, Andreas Grabher a écrit :
>> I don’t think this patch is a good solution.
>> https://git.tuxfamily.org/hatari/hatari.git/commit/?id=943006bc662e8ad7a0b364ff3b91907f40523303 <https://git.tuxfamily.org/hatari/hatari.git/commit/?id=943006bc662e8ad7a0b364ff3b91907f40523303>
>> It just makes things complicated. Would’t it be easier to just rename the bits variable in scc.c? For example:
>> static voidSCC_Update_RR0_Clear ( int Channel , int clear_bits )
>> {
>> SCC.Chn[ Channel ].RR0_No_Latch &= ~clear_bits;
>> }
>> static voidSCC_Update_RR0_Set ( int Channel , int set_bits )
>> {
>> SCC.Chn[ Channel ].RR0_No_Latch |= set_bits;
>> }
>
> Hi
>
> At first, I wanted to rename all "bits" variables in Hatari, but there're quite a lot over the files and also I don't see why code in Hatari (excluding cpu core) should be dependant of some variables names that are used only for the cpu core, so I'd rather disable these enum when outside of the cpu core.
> That's a little hack, but I think it's better than renaming everything and adding in our docs that "bits" is now some kind of reserved word that can't be used anymore to name a variable.
>
> other method could be to split readcpu.h in 2 files and only include the file that don't declare the enum's in hatari's files, but that would create more differences with WinUAE's cpu core, which doesn't make things easier to keep track of changes in WinUAE.
>
> Nicolas
>
I don’t see many uses of bits outside the CPU core. I think it would be much cleaner to just rename them or leave it as is. It is just a warning (I think it is enabled by -Wshadow=local flag) and there are no impacts on functionality anyway. Adding compile-time checks that resolve to true of false depending on where a file is included from can cause bugs that are very hard to find.
Andreas