On 13/11/15 00:00, Carsten Haitzler wrote:
> On Thu, 12 Nov 2015 16:26:27 +0100 Stefan Schmidt <ste...@osg.samsung.com> 
> said:
>
>> Hello.
>>
>> I took a moment to run our code through the sparse semantic parser.
>> https://sparse.wiki.kernel.org/index.php/Main_Page
>>
>> You can easily do so as well by installing sparse and run "make CC=cgcc"
>> to enable the build wrapper.
>>
>> But now to some actual findings. Really most of it has been noise and i
>> reduced it to some things here manually.
>>
>> Find some remarks on some of the categories inside. If you feel like
>> this is on your turf and you either think its false positive or you are
>> going to fix it let me know.
>>
>> lib/eina/eina_fp.c:14:4: warning: constant 0x0000000100000000 is so big
>> it is long
>> lib/eina/eina_fp.c:439:17: warning: constant 0x00000003243f6a89 is so
>> big it is long
>> lib/eina/eina_fp.c:440:17: warning: constant 0x00000003243f6a89 is so
>> big it is long
>> lib/eina/eina_fp.c:441:18: warning: constant 0x00000003243f6a89 is so
>> big it is long
>> lib/eina/eina_fp.c:447:28: warning: constant 0x00000003243f6a89 is so
>> big it is long
>> lib/eina/eina_fp.c:447:46: warning: constant 0x00000003243f6a89 is so
>> big it is long
>> lib/eina/eina_fp.c:453:31: warning: constant 0x00000003243f6a89 is so
>> big it is long
>> lib/eina/eina_fp.c:479:17: warning: constant 0x00000003243f6a89 is so
>> big it is long
>> lib/ecore/ecore_anim.c:583:16: warning: constant 0x00000003243f6a89 is
>> so big it is long
>> lib/ecore/ecore_anim.c:583:16: warning: constant 0x00000003243f6a89 is
>> so big it is long
>> lib/ecore/ecore_anim.c:588:16: warning: constant 0x00000003243f6a89 is
>> so big it is long
>> lib/ecore/ecore_anim.c:593:16: warning: constant 0x00000003243f6a89 is
>> so big it is long
>>
>> -----
>>
>> lib/eina/eina_rbtree.c:63:33: error: dubious one-bit signed bitfield
>> lib/eina/eina_thread_queue.c:62:42: error: dubious one-bit signed bitfield
>> lib/evas/canvas/evas_object_text.c:71:43: error: dubious one-bit signed
>> bitfield
>> lib/evas/canvas/evas_object_text.c:72:46: error: dubious one-bit signed
>> bitfield
>> modules/evas/engines/buffer/evas_engine.h:47:51: error: dubious one-bit
>> signed bitfield
>> modules/evas/engines/buffer/evas_engine.h:48:49: error: dubious one-bit
>> signed bitfield
>> modules/evas/engines/buffer/Evas_Engine_Buffer.h:24:30: error: dubious
>> one-bit signed bitfield
>> modules/evas/engines/buffer/evas_engine.h:47:51: error: dubious one-bit
>> signed bitfield
>> modules/evas/engines/buffer/evas_engine.h:48:49: error: dubious one-bit
>> signed bitfield
>> ../src/modules/evas/engines/buffer/Evas_Engine_Buffer.h:24:30: error:
>> dubious one-bit signed bitfield
>> ../src/modules/evas/engines/buffer/Evas_Engine_Buffer.h:24:30: error:
>> dubious one-bit signed bitfield
>> ../src/modules/evas/engines/buffer/Evas_Engine_Buffer.h:24:30: error:
>> dubious one-bit signed bitfield
>> ../src/modules/evas/engines/buffer/Evas_Engine_Buffer.h:24:30: error:
>> dubious one-bit signed bitfield
>> lib/ecore_ipc/ecore_ipc_private.h:84:35: error: dubious one-bit signed
>> bitfield
>> lib/ecore_ipc/ecore_ipc_private.h:102:35: error: dubious one-bit signed
>> bitfield
>> modules/ecore_evas/engines/x/ecore_evas_x.c:902:29: error: dubious
>> one-bit signed bitfield
>> modules/ecore_evas/engines/x/ecore_evas_x.c:903:33: error: dubious
>> one-bit signed bitfield
>> modules/ecore_evas/engines/x/ecore_evas_x.c:904:30: error: dubious
>> one-bit signed bitfield
>> modules/ecore_evas/engines/x/ecore_evas_x.c:905:34: error: dubious
>> one-bit signed bitfield
>> modules/ecore_evas/engines/x/ecore_evas_x.c:906:34: error: dubious
>> one-bit signed bitfield
>> modules/evas/image_loaders/gif/evas_image_load_gif.c:37:23: error:
>> dubious one-bit signed bitfield
>>
>> Funny one. This bitfields are signed so they can only hold -1 and 0. Not
>> a real bummer as we normally use them in if (x) only but if we have
>> cases where we really expect an 1 after we might be in trouble. Could be
>> a good idea wot move them over to Eina_Bool.
>
> not sure it makes any difference. if it's a 1 bit  field... it will always be
> used with if (x) or if (!x) ... setting it to 1 yes - will set it to -1, but 
> we
> don't care really. :) well ok - the way i use bitfields like this it doesn't
> matter, as i would never do if (x == 1) or if (x == 0) on them - ever. it's 
> far
> too long for me :) i get why it MAY be a problem (like this example) but it's
> stupid code to write imho...

There are places where we do (x ^ y) to quickly xor two truth values. 
Though I think it usually looks like: (!!x ^ !!y), or ((bla == 5) ^ 
(!y)) or something like that.

Even if it's not an issue, it's definitely a good thing to keep in mind 
and be defensive about.

--
Tom.


>
>> -----
>>
>> lib/emile/emile_main.c:149:53: warning: right shift by bigger than
>> source value
>> lib/emile/emile_main.c:150:53: warning: right shift by bigger than
>> source value
>> lib/emile/emile_main.c:151:53: warning: right shift by bigger than
>> source value
>>
>> Cedric?
>>
>> -----
>>
>> static_libs/rg_etc/rg_etc1.c:1444:21: warning: crazy programmer
>> static_libs/rg_etc/rg_etc1.c:1458:21: warning: crazy programmer
>> static_libs/rg_etc/rg_etc1.c:1483:21: warning: crazy programmer
>> modules/evas/image_savers/tgv/evas_image_save_tgv.c:49:14: warning:
>> crazy programmer
>>
>> Man, I love this warnings. :)
>
> i detect a cedric! :)
>
>> -----
>>
>> lib/ecore_input/ecore_input_compose.h:9900:19: warning: trying to
>> concatenate 63013-character string (8191 bytes max)
>
> i'm rather proud of this bit of pure evil in efl. :)
>
>> modules/evas/engines/gl_common/shader_3d/evas_gl_3d_shaders.x:975:9:
>> warning: trying to concatenate 8394-character string (8191 bytes max)
>> modules/evas/engines/gl_common/shader_3d/evas_gl_3d_shaders.x:1441:9:
>> warning: trying to concatenate 10118-character string (8191 bytes max)
>> modules/evas/engines/gl_common/shader_3d/evas_gl_3d_shaders.x:2113:9:
>> warning: trying to concatenate 11086-character string (8191 bytes max)
>>
>> What are we going to do about this? Do we take our maximal size for
>> strings seriously or does this not really matter?
>
> as i read it compilers MUST provide at LEAST 2048 bytes for such strings (c89)
> and i think c99 raised it as a minimum to 4096. i have no idea where this 8192
> limit comes from (8191 chars plus 0 byte). as such we have had this almost 65k
> string in efl for years now and it has never hit a problem - it should at
> compile time (compiler should overflow whatever buffer size it has and
> barf)... unless the compiler is majorly sucky. maybe 8192 was just a number
> thrown into this tool as a "really long string" number to be worried about if
> the string is that big? ie - maybe you didn't mean this to happen?
>
>> -----
>>
>> lib/evas/canvas/evas_map.c:284:27: warning: Variable length array is used.
>
> this one is indeed dubious. it's declaring a variable size array based on 
> local
> vars at the time of the call. this should become an alloca. likely for all of
> these too (haven't looked).
>
>> lib/ector/software/ector_software_rasterizer.c:215:22: warning: Variable
>> length array is used.
>> lib/ector/software/ector_software_rasterizer.c:250:22: warning: Variable
>> length array is used.
>> lib/ecore_x/xlib/ecore_x_randr.c:559:42: warning: Variable length array
>> is used.
>> modules/evas/engines/gl_common/evas_gl_3d_shader.c:181:20: warning:
>> Variable length array is used.
>> bin/evas/evas_cserve2_shm_debug.c:42:14: warning: Variable length array
>> is used.
>>
>> -----
>>
>> lib/emotion/emotion_webcam.c:120:27: warning: dubious: !x & y
>>
>> -----
>>
>> modules/evas/engines/gl_common/evas_gl_core.c:1624:46: error: too many
>> arguments for function glsym_evas_gl_native_context_get
>> modules/evas/engines/gl_common/evas_gl_core.c:1638:40: error: too many
>> arguments for function glsym_evas_gl_engine_data_get
>>
>> Seems to be a misunderstanding of the function pointer.
>
> yeah. we have an unusual () as the args - in c this means (0 OR more
> arguments). you can actually pass anything you like... you don't get any
> param/type checking then though.
>
>> -----
>>
>> modules/evas/engines/gl_x11/evas_engine.c:230:39: error: too many
>> arguments for function glsym_evas_gl_common_error_set
>> modules/evas/engines/gl_x11/evas_engine.c:285:44: error: too many
>> arguments for function glsym_evas_gl_common_error_set
>> modules/evas/engines/gl_x11/evas_engine.c:310:44: error: too many
>> arguments for function glsym_evas_gl_common_error_set
>> modules/evas/engines/gl_x11/evas_engine.c:329:39: error: too many
>> arguments for function glsym_evas_gl_common_error_set
>> modules/evas/engines/gl_x11/evas_engine.c:358:39: error: too many
>> arguments for function glsym_evas_gl_common_error_set
>> modules/evas/engines/gl_x11/evas_engine.c:374:39: error: too many
>> arguments for function glsym_evas_gl_common_error_set
>> modules/evas/engines/gl_x11/evas_engine.c:381:39: error: too many
>> arguments for function glsym_evas_gl_common_error_set
>> modules/evas/engines/gl_x11/evas_engine.c:404:39: error: too many
>> arguments for function glsym_evas_gl_common_error_set
>> modules/evas/engines/gl_x11/evas_engine.c:446:39: error: too many
>> arguments for function glsym_evas_gl_common_error_set
>> modules/evas/engines/gl_x11/evas_engine.c:474:39: error: too many
>> arguments for function glsym_evas_gl_common_error_set
>> modules/evas/engines/gl_x11/evas_engine.c:481:39: error: too many
>> arguments for function glsym_evas_gl_common_error_set
>> modules/evas/engines/gl_x11/evas_engine.c:557:81: error: too many
>> arguments for function glsym_evas_gl_common_error_set
>> modules/evas/engines/gl_x11/evas_engine.c:558:66: error: too many
>> arguments for function glsym_evas_gl_common_error_set
>> modules/evas/engines/gl_x11/evas_engine.c:576:48: error: too many
>> arguments for function glsym_evas_gl_common_error_set
>> modules/evas/engines/gl_x11/evas_engine.c:577:53: error: too many
>> arguments for function glsym_evas_gl_common_error_set
>> modules/evas/engines/gl_x11/evas_engine.c:599:39: error: too many
>> arguments for function glsym_evas_gl_common_error_set
>> modules/evas/engines/gl_x11/evas_engine.c:632:39: error: too many
>> arguments for function glsym_evas_gl_common_error_set
>> modules/evas/engines/gl_x11/evas_engine.c:641:39: error: too many
>> arguments for function glsym_evas_gl_common_error_set
>> modules/evas/engines/gl_x11/evas_engine.c:850:39: error: too many
>> arguments for function glsym_evas_gl_common_error_set
>> modules/evas/engines/gl_x11/evas_engine.c:857:39: error: too many
>> arguments for function glsym_evas_gl_common_error_set
>> modules/evas/engines/gl_x11/evas_engine.c:895:39: error: too many
>> arguments for function glsym_evas_gl_common_error_set
>> modules/evas/engines/gl_x11/evas_engine.c:902:39: error: too many
>> arguments for function glsym_evas_gl_common_error_set
>> modules/evas/engines/gl_x11/evas_engine.c:923:39: error: too many
>> arguments for function glsym_evas_gl_common_error_set
>> modules/evas/engines/gl_x11/evas_engine.c:1127:39: error: too many
>> arguments for function glsym_evas_gl_common_error_set
>> modules/evas/engines/gl_x11/evas_engine.c:1145:39: error: too many
>> arguments for function glsym_evas_gl_common_error_set
>> modules/evas/engines/gl_x11/evas_engine.c:1545:40: error: too many
>> arguments for function glsym_evas_gl_common_shaders_flush
>> modules/evas/engines/gl_x11/evas_engine.c:1967:45: error: too many
>> arguments for function glsym_evas_gl_common_error_get
>> modules/evas/engines/gl_x11/evas_engine.c:1982:34: error: too many
>> arguments for function glsym_evas_gl_common_error_set
>
> same for this as above. making use of () == 0 or more params. the tool doesn't
> understand this bit of c so it is tehcnically wrong. :)
>
>> -----
>>
>> lib/ecore_wayland/ecore_wl_input.c:128:4: warning: incorrect type in
>> initializer (incompatible argument 3 (different signedness))
>> lib/ecore_wayland/ecore_wl_input.c:128:4:    expected void (
>> *capabilities )( ... )
>> lib/ecore_wayland/ecore_wl_input.c:128:4:    got void ( static
>> [toplevel] *<noident> )( ... )
>>
>> Have fun with these.
>>
>> regards
>> Stefan Schmidt
>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> enlightenment-devel mailing list
>> enlightenment-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
>>
>
>


------------------------------------------------------------------------------
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to