[Geany-devel] Ideas on increasing quality of plugins

Lex Trotman elextr at xxxxx
Sun Mar 13 01:38:32 UTC 2011


On 13 March 2011 09:34, Colomban Wendling <lists.ban at herbesfolles.org> wrote:
> Le 11/03/2011 19:37, Colomban Wendling a écrit :
>> Le 08/03/2011 22:29, Colomban Wendling a écrit :
>> I'd like to commit this to the Autotools build system:
>>
>> 1) run cppcheck on `make check`;
>> 2) enable by default, if compiler understands them, the following
>> warnings (discussed in other mails of this thread):
>>  * -Werror=implicit-function-declaration
>>  * -Werror=pointer-arith
>>  * -Wundef
>>  * -Wshadow
>>  * -Wwrite-strings
>
> After thinking a little further, I updated my flags list first to remove
> error= stuff to fit the discussion result, and propose a few more,
> extracted from -Wall:
>
>  * -Warray-bounds: warns about some out-of-bound array subscripting
>  * -Wformat: warns about wrong format/arguments in printf-like functions
>  * -Wimplicit-int: warns if the return type of a function is not missing

Actually warns when the function type IS missing, but know what you mean :-)

>  * -Wimplicit-function-declaration: warns if a function is not defined
>  * -Wnonnull: warns when passing NULL as argument marked as non-nullable
>  * -Wpointer-arith: warns about arithmetic usage of untyped pointers
>  * -Wreturn-type: warns about missing return values in functions
>  * -Wsequence-point: warns when the code might result to undefined
> result (e.g. "a[i++] = i")
>  * -Wshadow: warns when shadowing symbols
>  * -Wstrict-aliasing: warns when breaking strict aliasing rules [1]
>  * -Wstrict-overflow=1: warns when breaking strict overflow rules [1]
>  * -Wtrigraphs: warns about trigraphs that may be interpreted
>  * -Wundef: warns when testing undefined constants with the preprocessor
>  * -Wuninitialized: warns when detecting use of undefined varaibles
>  * -Wunused-value: warns when computing an unused value
>  * -Wunused-variable: warns about unused variables
>  * -Wwrite-strings: makes string literals constant, used to find case
> where string literals are used as a modifiable value, which should be
> avoided.
>
> All of these but -Wpointer-arith, -Wshadow, -Wundef and -Wwrite-strings
> are part of GCC's -Wall.
> Maybe we might directly use -Wall, but it warns about some things that
> are not really needed, such as unused functions.
>
> Actually, apart -Wwrite-strings, these flags don't show so much warnings :)
>
> So (once again), do these flags seems reasonable to you?

Well if they are warnings only, the more the merrier, I'd use -Wall
and -Wextras but noting that there is a possibility that some plugin
might need a customised list if there is a good reason why it is
correct and can't reasonably avoid some warning.  Up to the plugin dev
to tell us why, but hey we're reasonable aren't we? :-)

Note most developers compile Geany itself with -Wall at least (iaw the
Hacking file) and Nick has some extras he likes.

Also note that some warnings need at least -O2 so the compiler does
the dataflow tracing needed to detect the warning.

Cheers
Lex

PS we are only talking about gcc flags here but I think we only supprt
gcc even on Windows, right Enrico?

>
>
> Cheers,
> Colomban
>
>
> [1] see GCC's manual for details ;)
> _______________________________________________
> Geany-devel mailing list
> Geany-devel at uvena.de
> http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
>



More information about the Devel mailing list