Client: c_glib
Patch: Simon South <ssouth@simonsouth.com>
The compiler now correctly generates code for string lists (i.e. variables of type list<string>) that are
- Passed as a parameter to a service method,
- Returned from a service method or
- Assigned a default value.
Added a unit test that covers containers (initially only string lists) used as parameters to and return values from
service methods, and as members with default values inside structs.
These changes allow the unit tests for C (GLib) to build without
compiler warnings, even with additional warnings enabled. They
include
- Disabling string-function optimizations when glibc is used, as
these produce compiler warnings when a string function is used
within a call to assert ();
- Remove the "LL" suffix (added in C99) from 64-bit integer
literals;
- Replace C++-style ("//") comments with C-style equivalents;
- Remove unused constant declarations that generated warnings;
and
- Mark (or remove, from main ()) unused function parameters.
This change
- Enables the same comprehensive set of warnings ("-Wall -Wextra
-pedantic") specified for the unit tests for C++ and
- Changes the use of automake variables (e.g. AM_CPPFLAGS) to more
closely match their intended use, as specified in the automake
documentation.
These changes allow the C (GLib) library to be built without
warnings from the compiler, even with extra compiler warnings
enabled. The changes involve
- Moving variable declarations to the top of every code block,
- Using unions instead of type-punning to follow strict-aliasing
rules,
- Replacing variable-length array declarations with arrays
allocated on the stack (using g_newa and g_alloca),
- Casting void pointers to a suitably sized data type before
performing arithmetic on them,
- Replacing C++-style ("//") comments with C-style equivalents,
and
- Removing an errant semicolon and comma.
This closes#576
Client: c_glib
Simon South <ssouth@simonsouth.com>
This closes#573
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.
Client: C_glib, C++, D, Erlang, Go, Haskell, Lua, Java/Me, JavaScript, Node, Ocaml, Perl, PHP, Python, Ruby
Patch: Jens Geyer
This closes#341
Minimal server-side implementations and TODO stubs for various languages to let "make check" succeeed.
Not contained in this patch and still TODO:
- client side implementations, i.e. calls to testBinary() and appropriate tests
- server side hex printout missing for some languages
Currently the following libraries are supported:
- C++
- C_Glib
- Java (using Ant wrapper)
The compilers CMake file is adjusted to work with the new global CMakeLists.txt file.
Signed-off-by: Roger Meier <r.meier@siemens.com>
Signed-off-by: Pascal Bach <pascal.bach@siemens.com>
Also-by: Sergei Nikulov <sergey.nikulov@gmail.com>