[ 
https://issues.apache.org/jira/browse/THRIFT-3331?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Simon South updated THRIFT-3331:
--------------------------------
    Attachment: 01-thrift-3331-warning-etype-may-be-uninitialized.patch

Jens, please try the attached (trivial) patch and let me know whether it 
silences this warning.

In this case the original code appears to be correct and gcc is being a little 
aggressive in detecting uninitialized variables, [a subject of some 
debate|https://gcc.gnu.org/wiki/Better_Uninitialized_Warnings]. A more 
substantial fix would involving initializing {{etype}} multiple times, which is 
obviously not a huge penalty but would make the code less efficient.

> warning: ‘etype’ may be used uninitialized in this function
> -----------------------------------------------------------
>
>                 Key: THRIFT-3331
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3331
>             Project: Thrift
>          Issue Type: Bug
>          Components: C glib - Compiler
>    Affects Versions: 0.9.3
>         Environment: openSuse 13.2
>            Reporter: Jens Geyer
>            Assignee: Simon South
>            Priority: Minor
>         Attachments: 01-thrift-3331-warning-etype-may-be-uninitialized.patch
>
>
> Compiling the compiler produces this warning:
> {code}
> src/generate/t_c_glib_generator.cc: In member function ‘void 
> t_c_glib_generator::generate_object(t_struct*)’:
> src/generate/t_c_glib_generator.cc:3122:59: warning: ‘etype’ may be used 
> uninitialized in this function [-Wmaybe-uninitialized]
>            if ((etype->is_base_type() && !etype->is_string())
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to