Clang warnings #867

Closed
kirbyfan64 opened this Issue Mar 10, 2015 · 4 comments

Projects

None yet

3 participants

@kirbyfan64
Contributor

Clang whines about passing -rdynamic for building objects. A lot:

[CC] threading/Thread
[CC] threading/native/ThreadUnix
[CC] math
[CC] threading/native/ThreadWin32
clang-3.7: warning: argument unused during compilation: '-rdynamic'
clang-3.7: warning: argument unused during compilation: '-rdynamic'
clang-3.7: warning: argument unused during compilation: '-rdynamic'
clang-3.7: warning: argument unused during compilation: '-rdynamic'
8 warnings generated.
[CC] native/win32/errors
clang-3.7: warning: argument unused during compilation: '-rdynamic'
[CC] threading/native/MutexUnix
clang-3.7: warning: argument unused during compilation: '-rdynamic'
[CC] threading/native/MutexWin32
[CC] threading/native/ThreadLocalUnix
[CC] threading/native/ThreadLocalWin32
clang-3.7: warning: argument unused during compilation: '-rdynamic'
clang-3.7clang-3.7: warning: argument unused during compilation: '-rdynamic'
: warning: argument unused during compilation: '-rdynamic'
[CC] structs/Stack
clang-3.7: warning: argument unused during compilation: '-rdynamic'
[CC] structs/LinkedList
[CC] os/Terminal
clang-3.7: warning: argument unused during compilation: '-rdynamic'
clang-3.7: warning: argument unused during compilation: '-rdynamic'
[CC] os/native/TerminalUnix
[CC] os/unistd
clang-3.7: warning: argument unused during compilation: '-rdynamic'
clang-3.7: warning: argument unused during compilation: '-rdynamic'
[CC] os/FileDescriptor
clang-3.7: warning: argument unused during compilation: '-rdynamic'
[CC] os/native/TerminalWin32
[CC] lang/Backtrace
[CC] os/Env
[CC] os/Dynlib
[CC] os/ShellUtils
clang-3.7: warning: argument unused during compilation: '-rdynamic'
clang-3.7: warning: argument unused during compilation: '-rdynamic'
clang-3.7: warning: argument unused during compilation: '-rdynamic'
clang-3.7: warning: argument unused during compilation: '-rdynamic'
clang-3.7: warning: argument unused during compilation: '-rdynamic'
[CC] io/File
clang-3.7: warning: argument unused during compilation: '-rdynamic'
[CC] io/FileReader
[CC] io/Reader
[CC] io/FileWriter
[CC] io/Writer
clang-3.7: warning: argument unused during compilation: '-rdynamic'
clang-3.7: warning: argument unused during compilation: '-rdynamic'
clang-3.7clang-3.7: warning: argument unused during compilation: '-rdynamic'
: warning: argument unused during compilation: '-rdynamic'
[CC] os/Pipe
[CC] os/native/PipeUnix
[CC] os/native/PipeWin32
[CC] io/BufferWriter
[CC] io/BufferReader
clang-3.7: warning: argument unused during compilation: '-rdynamic'
clang-3.7: warning: argument unused during compilation: '-rdynamic'
clang-3.7: warning: argument unused during compilation: '-rdynamic'
clang-3.7: warning: argument unused during compilation: '-rdynamic'
clang-3.7: warning: argument unused during compilation: '-rdynamic'
[CC] io/native/FileWin32
[CC] io/native/FileUnix
[CC] text/StringTokenizer
[CC] io/StringReader
[CC] lang/internals/mangling
clang-3.7: warning: argument unused during compilation: '-rdynamic'
clang-3.7: warning: argument unused during compilation: '-rdynamic'
clang-3.7: warning: argument unused during compilation: '-rdynamic'
clang-3.7: warning: argument unused during compilation: '-rdynamic'
clang-3.7: warning: argument unused during compilation: '-rdynamic'
[CC] os/Process
[CC] os/native/ProcessUnix
clang-3.7: warning: argument unused during compilation: '-rdynamic'
clang-3.7: warning: argument unused during compilation: '-rdynamic'
[CC] os/wait
[CC] os/native/ProcessWin32
[CC] text/Shlex
clang-3.7clang-3.7: warning: argument unused during compilation: '-rdynamic'
clang-3.7: : warningwarning: argument unused during compilation: '-rdynamic'
: argument unused during compilation: '-rdynamic'

Also, I keep getting this warning for various files:

[CC] text/Shlex
clang-3.7clang-3.7: warning: argument unused during compilation: '-rdynamic'
clang-3.7: : warningwarning: argument unused during compilation: '-rdynamic'
: argument unused during compilation: '-rdynamic'
/media/ryan/stuff/rock/sdk/os/Process.ooc:41:40: warning: indirection of
      non-volatile null pointer will be deleted, not trap [-Wnull-dereference]
  ...arg = _lang_array__Array_get(args, i, lang_String__String*);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.libs/ooc/sdk/Array.h:21:5: note: expanded from macro '_lang_array__Array_get'
    *((type*) NULL) : \
    ^~~~~~~~~~~~~~~
/media/ryan/stuff/rock/sdk/os/Process.ooc:41:40: note: consider using
      __builtin_trap() or qualifying pointer with 'volatile'
.libs/ooc/sdk/Array.h:21:5: note: expanded from macro '_lang_array__Array_get'
    *((type*) NULL) : \
    ^
1 warning generated.

This is all while building Sam.

@zhaihj
Contributor
zhaihj commented Mar 10, 2015

About null-dereference, see this issue:#732

this pr fix the rdynamic problem #847
you can find more details here: zhaihj@2e167a2

@kirbyfan64
Contributor

For the null-deref issue, can't Rock just automatically pass -Wno-null-dereference?

Clang will also be silent about unused arguments if passed -Qunused-arguments.

@zhaihj
Contributor
zhaihj commented Mar 11, 2015

If you are really nervous about null-dereference warnings, you can disable it by changing

    *((type*) NULL) : \

to something like

    ((type*) array.data)[0] : \

in sdk/lang/Array.h. Currently it is the only source of null-dereference.

I'm wondering if disabling warnings is really a good solution, because rock may fail to detect some common errors, while clang or gcc work well. Less warnings means less chances to find the source of those weird bugs.

@fasterthanlime
Collaborator

Well, #847 has been merged, and the other ones were closed in 11eb3e2, so I think this can be closed.

@fasterthanlime fasterthanlime modified the milestone: 0.9.10 Jul 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment