[
https://issues.apache.org/jira/browse/THRIFT-3285?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14650508#comment-14650508
]
ASF GitHub Bot commented on THRIFT-3285:
----------------------------------------
GitHub user simonsouth opened a pull request:
https://github.com/apache/thrift/pull/576
THRIFT-3285 c glib build library with all warnings enabled
These changes
- Update the C (GLib) library's makefile so the AM_CPPFLAGS and AM_CFLAGS
variables are used correctly according to automake's documentation,
- Enable the same compiler warnings enabled during the C++-library build,
and
- Update portions of the library so it will build without generating any
compiler warnings.
The changes to the library itself comprise
- Moving variable declarations to the top of every code block,
- Using unions instead of type-punning to obey 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.
Applying these changes should allow us to also close THRIFT-2795,
"thrift_binary_protocol.c: 'dereferencing type-punned pointer will break
strict-aliasing rules'".
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/simonsouth/thrift
thrift-3285-c_glib-build-library-with-all-warnings-enabled
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/thrift/pull/576.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 #576
----
commit 231a33cbfa5c81ab8efd8cbc54bb083d3ed2368d
Author: Simon South <[email protected]>
Date: 2015-08-01T17:00:50Z
c_glib: Library: Use AM_CPPFLAGS for include paths, not AM_CFLAGS
This follows the description of the two variables in the automake
documentation.
commit d4919d5dd17943ff45996566de8146d279930eaf
Author: Simon South <[email protected]>
Date: 2015-08-01T17:05:08Z
c_glib: Library: Build with all warnings enabled
This matches the settings ("-Wall -Wextra -pedantic") used to build
the C++ library.
commit 1e3114c68d22972dd2e559c73cf0adaa0e25bd05
Author: Simon South <[email protected]>
Date: 2015-08-01T18:33:20Z
c_glib: Library: Build without compiler warnings
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.
----
> c_glib: Build library with all warnings enabled, no warnings generated
> ----------------------------------------------------------------------
>
> Key: THRIFT-3285
> URL: https://issues.apache.org/jira/browse/THRIFT-3285
> Project: Thrift
> Issue Type: Improvement
> Components: C glib - Library
> Affects Versions: 0.9.3
> Environment: Cloud9 (Ubuntu 14.04.2 LTS; gcc 4.8.2)
> Reporter: Simon South
> Assignee: Simon South
> Priority: Minor
> Labels: c_glib, library, warnings
>
> For correctness and to help with tracking down bugs, the C (GLib) library
> should build with the same compiler-warning options enabled for the C++
> library ({{-Wall -Wextra -pedantic}}) and without any warnings generated.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)