Skip to content

Commit

Permalink
OTHER: wscript: make implicit function declarations an error in C code
Browse files Browse the repository at this point in the history
Implicit function declarations can lead to hard to debug errors on 64-bit systems
(int is usually 32bit there, while arguments have all chances to be 64bit).

It also converts link-time failures to compile-time ones. Fresh example:

    $ LANG=C ./waf build
    Waf: Entering directory `/mnt/archive/work/dev/git/xmms2-devel/slyfox/_build_'
    [ 83/337] cc: src/clients/lib/xmmsclient/visualization/unixshm.c -> _build_/default/src/clients/lib/xmmsclient/visualization/unixshm_1.o
    [ 84/337] cc: src/clients/lib/xmmsclient-glib/xmmsclient-glib.c -> _build_/default/src/clients/lib/xmmsclient-glib/xmmsclient-glib_1.o
    ../src/clients/lib/xmmsclient/visualization/unixshm.c: In function 'decrement_client':
    ../src/clients/lib/xmmsclient/visualization/unixshm.c:102: error: implicit declaration of function 'semtimedop' [-Wimplicit-function-declaration]
    Waf: Leaving directory `/mnt/archive/work/dev/git/xmms2-devel/slyfox/_build_'
    Build failed
     -> task failed (err #1):
            {task: cc unixshm.c -> unixshm_1.o}

Patch also adds pretty-printer for warnings: -fdiagnostics-show-option
Warings are now seen with flags generating them:

    ../src/lib/xmmstypes/value.c:2385: warning: 'XMMSV_TYPE_UINT32_IS_DEPRECATED'
    is deprecated (declared at ../src/include/xmmsc/xmmsv.h:43) [-Wdeprecated-declarations]

    ../src/clients/lib/xmmsclient/bindata.c:36: warning: unused variable 'res' [-Wunused-variable]

    ../src/clients/lib/xmmsclient++/playlist.cpp:201: warning: 'xmmsc_result_t*
    xmmsc_playlist_insert_args(xmmsc_connection_t*, const char*, int, const char*, int, const char**)'
    is deprecated (declared at ../src/include/xmmsclient/xmmsclient.h:95) [-Wdeprecated-declarations]

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
  • Loading branch information
Sergei Trofimovich authored and dsvensson committed Apr 28, 2011
1 parent 1cd38a5 commit 1dc66e4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions wscript
Expand Up @@ -300,6 +300,10 @@ def configure(conf):
flags.disable_c_warning('format-extra-args')
flags.disable_c_warning('format-zero-length')

flags.enable_feature('diagnostics-show-option')

flags.enable_c_error('implicit-function-declaration')

conf.env['XMMS_PKGCONF_FILES'] = []
conf.env['XMMS_OUTPUT_PLUGINS'] = [(-1, "NONE")]

Expand Down

0 comments on commit 1dc66e4

Please sign in to comment.