[
https://issues.apache.org/jira/browse/THRIFT-3260?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14649051#comment-14649051
]
ASF GitHub Bot commented on THRIFT-3260:
----------------------------------------
GitHub user simonsouth opened a pull request:
https://github.com/apache/thrift/pull/573
THRIFT-3260 multiple warnings in c glib tutorial
Here are additional changes that should really and truly resolve all the
warnings generated when building the c_glib tutorial:
Compiler
- Do not output a trailing comma in exception-enum definitions.
- Move variable declarations to avoid mixing declarations and code in
generated code.
- Improve the readability of affected code blocks (and rely on indent_up
and indent_down for indentation).
Library
- Use only C-style comments in headers included by clients.
Tutorial
- Move THRIFT_UNUSED_VAR calls to avoid mixing declarations and code.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/simonsouth/thrift
thrift-3260-multiple-warnings-in-c_glib-tutorial
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/thrift/pull/573.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #573
----
commit 5359a2432c0b67b8756e1cd964054ee3f4adb46f
Author: Simon South <[email protected]>
Date: 2015-07-28T10:48:55Z
c_glib: Compiler: Omit spurious ";" after GObject type macros
commit 99b60a1aaf9356fbd1e02f63fb7c3c1e9a0061b0
Author: Simon South <[email protected]>
Date: 2015-07-28T10:57:37Z
c_glib: Compiler: Suppress unused-var warnings in client initializers
commit 344998fbdcdb3bf23a593a5983a4658d7a29d921
Author: Simon South <[email protected]>
Date: 2015-07-28T11:53:33Z
c_glib: Tutorial: Remove spurious ";" from GObject type macro
commit c40ac038e349167fc870af5d3de4ed471d0cf037
Author: Simon South <[email protected]>
Date: 2015-07-28T15:06:39Z
c_glib: Tutorial: Silence unused-function warnings
commit 8ff3674b068e1edd1d701d6390ac9c90122e7230
Author: Simon South <[email protected]>
Date: 2015-07-31T08:52:39Z
c_glib: Do not use C++-style comments in library headers
commit 77f5ecece7256ce5ce1a2c5042a791d77b476677
Author: Simon South <[email protected]>
Date: 2015-07-31T09:33:55Z
c_glib: Compiler: Omit superfluous comma from generated enum
commit c639c4c2b0c0a791e51338e468eaf89b84192571
Author: Simon South <[email protected]>
Date: 2015-07-31T09:39:25Z
c_glib: Compiler: Beautify code changed in previous commit
commit 6fbc0714ff300f66b0df66852cf350f04053b72b
Author: Simon South <[email protected]>
Date: 2015-07-31T10:16:32Z
c_glib: Compiler: Beautify code changed in previous commit
commit 0ac6c5c7ff31b2b1364b13646f63d85645dfc2d3
Author: Simon South <[email protected]>
Date: 2015-07-31T10:23:22Z
c_glib: Compiler: Don't mix declarations, code in generated code
commit 10233cc727142906ebc86a51d1ee9d05d4e0b42e
Author: Simon South <[email protected]>
Date: 2015-07-31T10:24:34Z
c_glib: Tutorial: Don't mix declarations, code
commit 543179a9ad2b04647ed1a9d0e1961b7214753b40
Author: Simon South <[email protected]>
Date: 2015-07-31T10:28:59Z
c_glib: Compiler: Beautify code changed in previous commit
----
> multiple warnings in c_glib tutorial
> ------------------------------------
>
> Key: THRIFT-3260
> URL: https://issues.apache.org/jira/browse/THRIFT-3260
> Project: Thrift
> Issue Type: Bug
> Components: C glib - Library
> Reporter: Jens Geyer
> Assignee: Simon South
> Attachments: tutorial.log
>
>
> {code}
> In file included from gen-c_glib/calculator.c:8:0:
> ../../lib/c_glib/src/thrift/c_glib/thrift.h:38:8: warning: C++ style comments
> are not allowed in ISO C90 [enabled by default]
> #endif // #ifndef _THRIFT_THRIFT_H
> ^
> ../../lib/c_glib/src/thrift/c_glib/thrift.h:38:8: warning: (this will be
> reported only once per input file) [enabled by default]
> In file included from gen-c_glib/calculator.h:12:0,
> from gen-c_glib/calculator.c:10:
> gen-c_glib/tutorial_types.h:95:31: warning: comma at end of enumerator list
> [-Wpedantic]
> INVALID_OPERATION_ERROR_CODE,
> ^
> gen-c_glib/calculator.c:68:79: warning: ISO C does not allow extra ';'
> outside of a function [-Wpedantic]
>
> calculator_if_interface_init));
>
> ^
> gen-c_glib/calculator.c: In function 'calculator_client_recv_ping':
> gen-c_glib/calculator.c:121:5: warning: ISO C90 forbids mixed declarations
> and code [-Wpedantic]
> ThriftApplicationException *xception = g_object_new
> (THRIFT_TYPE_APPLICATION_EXCEPTION, NULL);
> ^
> gen-c_glib/calculator.c: In function 'calculator_client_recv_add':
> gen-c_glib/calculator.c:292:5: warning: ISO C90 forbids mixed declarations
> and code [-Wpedantic]
> ThriftApplicationException *xception = g_object_new
> (THRIFT_TYPE_APPLICATION_EXCEPTION, NULL);
> ^
> gen-c_glib/calculator.c: In function 'calculator_client_recv_calculate':
> gen-c_glib/calculator.c:477:5: warning: ISO C90 forbids mixed declarations
> and code [-Wpedantic]
> ThriftApplicationException *xception = g_object_new
> (THRIFT_TYPE_APPLICATION_EXCEPTION, NULL);
> ^
> gen-c_glib/calculator.c: In function 'calculator_client_init':
> gen-c_glib/calculator.c:672:43: warning: unused parameter 'client'
> [-Wunused-parameter]
> calculator_client_init (CalculatorClient *client)
> ^
> gen-c_glib/calculator.c: In function 'calculator_client_class_init':
> gen-c_glib/calculator.c:677:54: warning: unused parameter 'cls'
> [-Wunused-parameter]
> calculator_client_class_init (CalculatorClientClass *cls)
> ^
> gen-c_glib/calculator.c: At top level:
> gen-c_glib/calculator.c:688:98: warning: ISO C does not allow extra ';'
> outside of a function [-Wpedantic]
>
> calculator_handler_calculator_if_interface_init));
>
> ^
> gen-c_glib/calculator.c:750:46: warning: ISO C does not allow extra ';'
> outside of a function [-Wpedantic]
> TYPE_SHARED_SERVICE_PROCESSOR);
> ^
> gen-c_glib/calculator.c: In function 'calculator_processor_process_ping':
> gen-c_glib/calculator.c:802:7: warning: ISO C90 forbids mixed declarations
> and code [-Wpedantic]
> ThriftApplicationException *xception =
> ^
> gen-c_glib/calculator.c: In function 'calculator_processor_process_add':
> gen-c_glib/calculator.c:898:7: warning: ISO C90 forbids mixed declarations
> and code [-Wpedantic]
> ThriftApplicationException *xception =
> ^
> gen-c_glib/calculator.c: In function 'calculator_processor_process_calculate':
> gen-c_glib/calculator.c:1014:9: warning: ISO C90 forbids mixed declarations
> and code [-Wpedantic]
> ThriftApplicationException *xception =
> ^
> gen-c_glib/calculator.c: In function 'calculator_processor_process_zip':
> gen-c_glib/calculator.c:1087:7: warning: ISO C90 forbids mixed declarations
> and code [-Wpedantic]
> ThriftApplicationException *xception =
> ^
> gen-c_glib/calculator.c: In function 'calculator_processor_dispatch_call':
> gen-c_glib/calculator.c:1133:20: warning: ISO C forbids assignment between
> function pointer and 'void *' [-Wpedantic]
> process_function = g_hash_table_lookup (self->process_map, method_name);
> ^
> gen-c_glib/calculator.c: In function 'calculator_processor_init':
> gen-c_glib/calculator.c:1231:24: warning: ISO C forbids passing argument 3 of
> 'g_hash_table_insert' between function pointer and 'void *' [-Wpedantic]
> calculator_processor_process_ping);
> ^
> In file included from /usr/include/glib-2.0/glib.h:50:0,
> from ../../lib/c_glib/src/thrift/c_glib/thrift.h:27,
> from gen-c_glib/calculator.c:8:
> /usr/include/glib-2.0/glib/ghash.h:67:13: note: expected 'gpointer' but
> argument is of type 'gboolean (*)(struct CalculatorProcessor *, gint32,
> struct ThriftProtocol *, struct ThriftProtocol *, struct GError **)'
> gboolean g_hash_table_insert (GHashTable *hash_table,
> ^
> gen-c_glib/calculator.c:1234:24: warning: ISO C forbids passing argument 3 of
> 'g_hash_table_insert' between function pointer and 'void *' [-Wpedantic]
> calculator_processor_process_add);
> ^
> In file included from /usr/include/glib-2.0/glib.h:50:0,
> from ../../lib/c_glib/src/thrift/c_glib/thrift.h:27,
> from gen-c_glib/calculator.c:8:
> /usr/include/glib-2.0/glib/ghash.h:67:13: note: expected 'gpointer' but
> argument is of type 'gboolean (*)(struct CalculatorProcessor *, gint32,
> struct ThriftProtocol *, struct ThriftProtocol *, struct GError **)'
> gboolean g_hash_table_insert (GHashTable *hash_table,
> ^
> gen-c_glib/calculator.c:1237:24: warning: ISO C forbids passing argument 3 of
> 'g_hash_table_insert' between function pointer and 'void *' [-Wpedantic]
> calculator_processor_process_calculate);
> ^
> In file included from /usr/include/glib-2.0/glib.h:50:0,
> from ../../lib/c_glib/src/thrift/c_glib/thrift.h:27,
> from gen-c_glib/calculator.c:8:
> /usr/include/glib-2.0/glib/ghash.h:67:13: note: expected 'gpointer' but
> argument is of type 'gboolean (*)(struct CalculatorProcessor *, gint32,
> struct ThriftProtocol *, struct ThriftProtocol *, struct GError **)'
> gboolean g_hash_table_insert (GHashTable *hash_table,
> ^
> gen-c_glib/calculator.c:1240:24: warning: ISO C forbids passing argument 3 of
> 'g_hash_table_insert' between function pointer and 'void *' [-Wpedantic]
> calculator_processor_process_zip);
> ^
> In file included from /usr/include/glib-2.0/glib.h:50:0,
> from ../../lib/c_glib/src/thrift/c_glib/thrift.h:27,
> from gen-c_glib/calculator.c:8:
> /usr/include/glib-2.0/glib/ghash.h:67:13: note: expected 'gpointer' but
> argument is of type 'gboolean (*)(struct CalculatorProcessor *, gint32,
> struct ThriftProtocol *, struct ThriftProtocol *, struct GError **)'
> gboolean g_hash_table_insert (GHashTable *hash_table,
> ^
> {code}
> and
> {code}
> In file included from gen-c_glib/shared_service.c:8:0:
> ../../lib/c_glib/src/thrift/c_glib/thrift.h:38:8: warning: C++ style comments
> are not allowed in ISO C90 [enabled by default]
> #endif // #ifndef _THRIFT_THRIFT_H
> ^
> ../../lib/c_glib/src/thrift/c_glib/thrift.h:38:8: warning: (this will be
> reported only once per input file) [enabled by default]
> gen-c_glib/shared_service.c:50:83: warning: ISO C does not allow extra ';'
> outside of a function [-Wpedantic]
>
> shared_service_if_interface_init));
>
> ^
> gen-c_glib/shared_service.c: In function
> 'shared_service_client_recv_get_struct':
> gen-c_glib/shared_service.c:154:5: warning: ISO C90 forbids mixed
> declarations and code [-Wpedantic]
> ThriftApplicationException *xception = g_object_new
> (THRIFT_TYPE_APPLICATION_EXCEPTION, NULL);
> ^
> gen-c_glib/shared_service.c: At top level:
> gen-c_glib/shared_service.c:318:106: warning: ISO C does not allow extra ';'
> outside of a function [-Wpedantic]
>
> shared_service_handler_shared_service_if_interface_init));
>
> ^
> gen-c_glib/shared_service.c:353:47: warning: ISO C does not allow extra ';'
> outside of a function [-Wpedantic]
> THRIFT_TYPE_DISPATCH_PROCESSOR);
> ^
> gen-c_glib/shared_service.c: In function
> 'shared_service_processor_process_get_struct':
> gen-c_glib/shared_service.c:418:7: warning: ISO C90 forbids mixed
> declarations and code [-Wpedantic]
> ThriftApplicationException *xception =
> ^
> gen-c_glib/shared_service.c: In function
> 'shared_service_processor_dispatch_call':
> gen-c_glib/shared_service.c:471:20: warning: ISO C forbids assignment between
> function pointer and 'void *' [-Wpedantic]
> process_function = g_hash_table_lookup (self->process_map, method_name);
> ^
> gen-c_glib/shared_service.c: In function 'shared_service_processor_init':
> gen-c_glib/shared_service.c:566:24: warning: ISO C forbids passing argument 3
> of 'g_hash_table_insert' between function pointer and 'void *' [-Wpedantic]
> shared_service_processor_process_get_struct);
> ^
> In file included from /usr/include/glib-2.0/glib.h:50:0,
> from ../../lib/c_glib/src/thrift/c_glib/thrift.h:27,
> from gen-c_glib/shared_service.c:8:
> /usr/include/glib-2.0/glib/ghash.h:67:13: note: expected 'gpointer' but
> argument is of type 'gboolean (*)(struct SharedServiceProcessor *, gint32,
> struct ThriftProtocol *, struct ThriftProtocol *, struct GError **)'
> gboolean g_hash_table_insert (GHashTable *hash_table,
> ^
> {code}
> and
> {code}
> In file included from c_glib_server.c:25:0:
> ../../lib/c_glib/src/thrift/c_glib/thrift.h:38:8: warning: C++ style comments
> are not allowed in ISO C90 [enabled by default]
> #endif // #ifndef _THRIFT_THRIFT_H
> ^
> ../../lib/c_glib/src/thrift/c_glib/thrift.h:38:8: warning: (this will be
> reported only once per input file) [enabled by default]
> In file included from gen-c_glib/calculator.h:12:0,
> from c_glib_server.c:34:
> gen-c_glib/tutorial_types.h:95:31: warning: comma at end of enumerator list
> [-Wpedantic]
> INVALID_OPERATION_ERROR_CODE,
> ^
> c_glib_server.c:103:40: warning: ISO C does not allow extra ‘;’ outside of a
> function [-Wpedantic]
> TYPE_CALCULATOR_HANDLER);
> ^
> c_glib_server.c: In function ‘tutorial_calculator_handler_calculate’:
> c_glib_server.c:178:3: warning: ISO C90 forbids mixed declarations and code
> [-Wpedantic]
> TutorialCalculatorHandler *self;
> ^
> c_glib_server.c: In function ‘tutorial_calculator_handler_get_struct’:
> c_glib_server.c:305:3: warning: ISO C90 forbids mixed declarations and code
> [-Wpedantic]
> gint key = (gint)key32;
> ^
> {code}
> and a whole lot more.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)