GNU bug report logs -
#64830
29.1; C++ treesitter mode no coloration
Previous Next
Reported by: David Come <david.come <at> ageagle.com>
Date: Mon, 24 Jul 2023 10:34:01 UTC
Severity: normal
Merged with 64818
Found in versions 29.1, 30.0.50
Done: Yuan Fu <casouri <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #91 received at 64830 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
> On Aug 28, 2024, at 5:33 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
>
>> From: Yuan Fu <casouri <at> gmail.com>
>> Date: Tue, 27 Aug 2024 22:36:46 -0700
>> Cc: Stefan Kangas <stefankangas <at> gmail.com>,
>> Alan Mackenzie <acm <at> muc.de>,
>> 64830 <at> debbugs.gnu.org
>>
>> +struct treesit_loaded_lang
>> +{
>> + /* The language object. */
>> + TSLanguage *lang;
>> + /* The path of the shared library. */
>> + const char *path;
>
> Gnu Coding Standard frowns on using "path" for anything except
> PATH-style directory lists. Please use "filename" or "fname" or
> something like that instead.
>
>> + Dl_info info;
>> + if (dladdr(langfn, &info))
>> + loaded_lang.path = info.dli_fname;
>
> dladdr is non-portable. We have dynlib_addr instead, and since
> treesit.c correctly uses dynlib.c functions already, using dynlib_addr
> is only natural.
>
>> + if (!lang.lang || !lang.path) return Qnil;
>> +
>> + return build_string (lang.path);
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> I think we should do
>
> return
> DECODE_FILE (make_unibyte_string (lang.filename, strlen (lang.filename));
>
> instead, because dynlib_addr (and dladdr as well) return encoded file
> names.
Ah, thanks for the review! TIL. Here’s the revised patch.
Yuan
[grammar-location.patch (application/octet-stream, attachment)]
This bug report was last modified 309 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.