Fix all warnings in gcc/clang (some ignored)

Fixed all warnings in gcc/clang (hopefully). Some warnings are disabled for sanity reasons.