[
https://issues.apache.org/jira/browse/THRIFT-3288?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14651762#comment-14651762
]
ASF GitHub Bot commented on THRIFT-3288:
----------------------------------------
GitHub user simonsouth opened a pull request:
https://github.com/apache/thrift/pull/577
THRIFT-3288 c glib build unit tests with all warnings enabled
**Note:** This pull request includes the changes from request #576 (to fix
THRIFT-3285), which should be applied first.
These changes
- Update the C (GLib) unit tests' Makefile so
- Compiler-flag variables are used correctly according to automake's
documentation and
- The same comprehensive set of compiler warnings is enabled as is used
for the C++ unit tests, and
- Update the unit tests so they build without generating any compiler
warnings.
As a bonus, the final commit gently refactors several compiler functions
changed as part of this work, primarily to improve readability and to more
consistently use helper functions for formatting rather than embed formatting
directly in the output.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/simonsouth/thrift
thrift-3288-c_glib_build-unit-tests-with-all-warnings-enabled
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/thrift/pull/577.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 #577
----
commit e8576592a47bb23cb18193aa4a3e735a0267361e
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 a9d4f38364377810d5dcd0213237d4788d6a5d5b
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 8c046440b4c3135b489f1676460081fc1e3a77ec
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.
commit dee826a4da55375e689601e1038f3ba7e254f933
Author: Simon South <[email protected]>
Date: 2015-08-01T12:18:12Z
Makefile.am: Enable warnings, improve automake-variable use
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.
commit adc9bfa70e1878934d74d896310adaa6d434e83a
Author: Simon South <[email protected]>
Date: 2015-08-01T14:33:17Z
c_glib: Compiler: Don't mix declarations and code
This change moves variable declarations to the top of code blocks
in the generated code, resolving a number of "ISO C90 forbids mixed
declarations and code" warnings when building the unit tests.
commit a2a809654ae42775d454aeb6a33009447ae64564
Author: Simon South <[email protected]>
Date: 2015-08-01T14:53:22Z
c_glib: Compiler: Silence unused-parameter warnings
This change modifies the generated class and interface initializers
so they don't generate "unused parameter" warnings when compiled.
commit 0927b0f715023c67f4e755dbbca2ce16d2fee6fe
Author: Simon South <[email protected]>
Date: 2015-08-03T10:51:16Z
c_glib: Build unit tests without compiler warnings
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.
commit f913bf03c78955afb0f0fcf3368feca8c7ab8f0c
Author: Simon South <[email protected]>
Date: 2015-08-03T11:11:29Z
c_glib: Compiler: Gently refactor functions
This change gently refactors a handful of recently modified
functions to
- Wrap lines at 80 columns,
- Improve readability (making the layout of the compiler's source
code more closely match that of the code it's generating),
- Use more consistently the indent_up/indent_down and
scope_up/scope_down helper functions rather than embedding
formatting characters directly, and
- Improve slightly the formatting of the generated code.
----
> c_glib: Build unit tests with all warnings enabled, no warnings generated
> -------------------------------------------------------------------------
>
> Key: THRIFT-3288
> URL: https://issues.apache.org/jira/browse/THRIFT-3288
> 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, unit-test
>
> For correctness and to help with tracking down bugs, the C (GLib) unit tests
> (in {{lib/c_glib/test}}) should build with the same compiler-warning options
> enabled for the C++ library's tests ({{-Wall -Wextra -pedantic}}) and without
> any warnings generated.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)