1458947: memory leak in compiler
1458787: resource leak in c_glib led to discovery of assert() abuse
1459090: fix string.find result check in JSON processor (unlikely)
This closes#1404
The thrift build system currently assumes that the thrift compiler is
always available in $(top_builddir)/compiler/cpp/thrift. However, in a
cross-compilation context, this location contains the thrift compiler
built for the target... which obviously will not run on the build
machine.
In order to support such cross-compilation situation, we introduce the
THRIFT variable as a an argument for the configure script (using
AC_ARG_VAR). If not specified, it defaults to the existing value of
using compiler/cpp/thrift from the build directory, but it can be
overridden when calling ./configure.
Note that $(top_builddir) cannot be used within the configure script,
so we simply use `pwd`, which is the same as the top_builddir.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
This closes#1336
This closes#1350
Clients: glib, C++
Patch: Jim Apple <jbapple-impala@apache.org>
This closes#1214
This patch fixes some undefined behavior were found using Clang's
UndefinedBehaviorSanitizer (UBSan). To check for undefined behavior,
run /build/docker/scripts/ubsan.sh. This is run during CI builds, as
well.
The examples of the types of undefined behavior fixed in this commit
are:
1. Enumerations exhibit undefined behavior when they have values
outside of a range dependent on the values of their enumerators, as
specified in C++14's chapter 7.2 ("Enumeration declarations"),
paragraph 8.
2. Left shift of negative values, used in zigzag encoding, is
undefined behavior. See 5.8 ("Shift operators"), paragraph 2 for
C++ and 6.5.7 ("Bitwise shift operators"), paragraph 4 for C99 and
C11.
Client: C (GLib)
Patch: Simon South <simonsouth@apache.org>
Deserialize empty strings as they are instead of returning NULL.
Expand test cases to clarify existing behavior when deserializing empty
binary fields.
Client: Compiler
Patch: Nobuaki Sukegawa, rebased by dtmuller
Also fixed by dtmuller:
* Add plugin namespace for erlang language binding
* Fix unit test test_const_value
* Don't clear type cache with every t_program conversion
* Type "wb" may not be supported by popen on non-Windows platforms
* Fix constness of AST type signatures
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.