[Geany-Devel] Plugins Quality Check

Lex Trotman elextr at xxxxx
Fri Feb 21 02:02:54 UTC 2014


On 21 February 2014 02:02, Colomban Wendling <lists.ban at herbesfolles.org> wrote:
> Le 20/02/2014 09:07, Lex Trotman a écrit :
>> [...]
>> geanygendoc - 2 warnings, extra switch case may be consequential,
>> unused function
>> [...]
>>
>> Unused functions and variables are probably inconsequential, unless
>> they are the result of a typo in the code meant to use them, they need
>> a quick check and correct.
>
> In geanygendoc, it was simply dead code because of a quick
> fix/workaround.  Removed, since anyway that code, while providing
> interesting (unused) feature, wasn't working properly.  And well, we
> have a VCS anyway to get back removed stuff if needed.
>
>> Extra switch case may indicate a typo, needs checking.
>
> But actually it doesn't.  It's due to the fact
> g_scanner_get_next_token() returns an enumeration type, while actually
> it should probably be an integer.  This function returns the next token
> type, and this can be any character, plus a few extra, and is
> implemented as an enumeration with a gap for naked bytes:
>
> enum {
>   /* few named bytes for convenience */
>   EOF = 0;
>   BRACE_OPEN = '{';
>   BRACE_CLOSE = '}';
>   /* ... */
>   EXTRA_STUFF = 256;
>   /* ... */
> }
>
> This relies on the enumeration type to be implemented as an integer and
> implicitly accept intermediate values.
>
> I "fixed" this by casting the return type to integer, but now in place of
>
>> ggd-file-type-loader.c: In function 'ggd_file_type_read_match':
>> ggd-file-type-loader.c:412:11: warning: case value '46' not in enumerated type 'GTokenType' [-Wswitch]
>>            case '.': /* skip it */ break;
>
> I get
>
>> ggd-file-type-loader.c: In function 'ggd_file_type_read_match':
>> ggd-file-type-loader.c:411:17: warning: cast from function call of type 'GTokenType' to non-matching type 'unsigned int' [-Wbad-function-cast]
>>          switch ((guint) g_scanner_get_next_token (scanner)) {
>
> way better, right?  So what can I tell you, get the GLib fixed? :)

You should write CTPL, C Token Parsing Library, and do it right ...
what do you mean, the names been taken?

Oh ok, do it the way discussed on IRC :)

Cheers
Lex

>
>
> Cheers,
> Colomban
> _______________________________________________
> Devel mailing list
> Devel at lists.geany.org
> https://lists.geany.org/cgi-bin/mailman/listinfo/devel


More information about the Devel mailing list