|
From: | Paul Eggert |
Subject: | Re: [PATCH 01/11] Fix base64 module to work with grub codebase |
Date: | Tue, 9 Nov 2021 10:52:07 -0800 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.1 |
On 10/28/21 12:32, Robbie Harwood wrote:
I don't know why Patrick chose to not use that instead, but a local test seems to work.
Is grub2 intended to be portable to compilers that don't support <stdbool.h>? If that's the issue, I suggest that grub2 stop worrying that. Surely every compiler of interest to grub2 supports <stdbool.h> already. And if you really need to support older compilers, the Gnulib stdbool module should suffice.
grub2 shims out config.h for some build targets (e.g., when not building utilities).
Why does it need to do that? Is this because of cross-building, and where <config.h> is for the utilities platform which is not the same as the target platform? If so, that suggests that you should run two 'configure' instances, one for the utilities and one for the target, and compile the base64 module twice if it's used in both places.
Longer-term, this problem could be avoided by dropping the const attribute from isbase64(). Since uchar_in_range is a macro, b64 is const, and to_uchar() doesn't do anything, the compiler should be able to infer this anyway. (Adding an inline marker to to_uchar() might help with this.) What do you think?
This could hurt performance as the const attribute is for users of base64.h, not for base64.c. A compiler that merely includes base64.h couldn't infer that isbase64 is const and therefore couldn't do common subexpression elimination, unless you use a heavyweight flag like gcc -flto that isn't practical for some applications.
[Prev in Thread] | Current Thread | [Next in Thread] |