[PATCH v2 04/28] bfd/elf-attrs.c: use ASCII character '(0x27) for single quote
Matthieu Longo
matthieu.longo@arm.com
Fri May 2 10:58:00 GMT 2025
On 2025-05-02 11:43, Jan Beulich wrote:
> On 02.05.2025 12:32, Matthieu Longo wrote:
>> ---
>> bfd/elf-attrs.c | 6 +++---
>> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> Since the description is empty: What's wrong with what's there?
>
> Jan
>
I apologize for this. The apparent simplicity of the patch misled me to
believe that the patch was simple enough for not having a detailed
description, but indeed it hides the real reason.
Our reviewing tool complains about the use of non-ASCII characters in
the diff. Here is the message:
"This file contains special Unicode characters that may maliciously hide
code and alter behavior. Unicode characters were found in this file that
may be safe and intentional, or may be malicious, making code appear one
way while executing another way."
Obviously, the usage is legitimate here, but it causes our reviewing
tool to generate an annoying warning. The usage of a non-ASCII simple
quote has clearly no benefit (except style maybe), and replacing it by a
ASCII simple quote has no impact on the code itself, except making our
reviewing tool happy.
I hope that this explanation will help.
Matthieu.
>> --- a/bfd/elf-attrs.c
>> +++ b/bfd/elf-attrs.c
>> @@ -104,7 +104,7 @@ vendor_obj_attrs_v1_size (bfd *abfd, int vendor)
>> list = list->next)
>> size += obj_attr_v1_size (list->tag, &list->attr);
>>
>> - /* <size> <vendor_name> NUL 0x1 <size> */
>> + /* <size> <vendor_name> NUL 0x1 <size> */
>> return (size
>> ? size + 10 + strlen (vendor_name)
>> : 0);
>> @@ -117,7 +117,7 @@ bfd_elf_obj_attrs_v1_size (bfd *abfd)
>> size = vendor_obj_attrs_v1_size (abfd, OBJ_ATTR_PROC);
>> size += vendor_obj_attrs_v1_size (abfd, OBJ_ATTR_GNU);
>> if (size > 0)
>> - size += sizeof(uint8_t); /* <format-version: ‘A’> */
>> + size += sizeof(uint8_t); /* <format-version: 'A'> */
>> return size;
>> }
>>
>> @@ -212,7 +212,7 @@ write_obj_attr_section_v1 (bfd *abfd, bfd_byte *buffer, bfd_vma size)
>> {
>> bfd_byte *p = buffer;
>>
>> - /* <format-version: ‘A’> */
>> + /* <format-version: 'A'> */
>> *(p++) = 'A';
>>
>> for (int vendor = OBJ_ATTR_FIRST; vendor <= OBJ_ATTR_LAST; ++vendor)
>
More information about the Binutils
mailing list