Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clang warnings #867

Closed
refi64 opened this issue Mar 10, 2015 · 4 comments

Comments

@refi64
Copy link
Contributor

commented Mar 10, 2015

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

This comment has been minimized.

Copy link
Contributor

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

@refi64

This comment has been minimized.

Copy link
Contributor Author

commented Mar 11, 2015

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

This comment has been minimized.

Copy link
Contributor

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 added a commit that referenced this issue Mar 17, 2015
@fasterthanlime

This comment has been minimized.

Copy link
Collaborator

commented Jul 9, 2015

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.