awkward icon indicating copy to clipboard operation
awkward copied to clipboard

Eliminate compiler/linker warnings

Open jpivarski opened this issue 1 year ago • 4 comments

Now that v1 has been dropped, all of the compiler warnings are v2 warnings and need to be addressed. MacOS (or probably Cling) shows a lot more warnings than Linux (gcc) does, and I am running with a Mac now and therefore see them. I can work through these, cleaning up the C++ code.

jpivarski avatar Sep 29 '22 14:09 jpivarski

#1858 fixes a lot of compiler warnings, but it doesn't address the linker warnings because I want to do that on top of #1778 (which might make some of them moot).

jpivarski avatar Nov 01 '22 23:11 jpivarski

After #1778, the issues on MacOS (Clang) are:

  ld: warning: -pie being ignored. It is only used when linking a main executable
  ld: warning: direct access in function 'pybind11::class_<awkward::ForthMachineOf<int, int>, std::__1::shared_ptr<awkward::ForthMachineOf<int, int> > > make_ForthMachineOf<int, int>(pybind11::handle const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)' from file '/tmp/lto.o' to global weak symbol 'awkward::ForthMachineOf<int, int>::is_segment_done() const' from file 'libawkward-static.a(ForthMachine.cpp.o)' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
  ld: warning: direct access in function 'pybind11::class_<awkward::ForthMachineOf<int, int>, std::__1::shared_ptr<awkward::ForthMachineOf<int, int> > > make_ForthMachineOf<int, int>(pybind11::handle const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)' from file '/tmp/lto.o' to global weak symbol 'awkward::ForthMachineOf<int, int>::is_segment_done() const' from file 'libawkward-static.a(ForthMachine.cpp.o)' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
  ld: warning: direct access in function 'pybind11::class_<awkward::ForthMachineOf<int, int>, std::__1::shared_ptr<awkward::ForthMachineOf<int, int> > > make_ForthMachineOf<int, int>(pybind11::handle const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)' from file '/tmp/lto.o' to global weak symbol 'awkward::ForthMachineOf<int, int>::is_done() const' from file 'libawkward-static.a(ForthMachine.cpp.o)' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
  ld: warning: direct access in function 'pybind11::class_<awkward::ForthMachineOf<int, int>, std::__1::shared_ptr<awkward::ForthMachineOf<int, int> > > make_ForthMachineOf<int, int>(pybind11::handle const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)' from file '/tmp/lto.o' to global weak symbol 'awkward::ForthMachineOf<int, int>::is_done() const' from file 'libawkward-static.a(ForthMachine.cpp.o)' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
  ld: warning: direct access in function 'pybind11::class_<awkward::ForthMachineOf<int, int>, std::__1::shared_ptr<awkward::ForthMachineOf<int, int> > > make_ForthMachineOf<int, int>(pybind11::handle const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)' from file '/tmp/lto.o' to global weak symbol 'awkward::ForthMachineOf<int, int>::is_ready() const' from file 'libawkward-static.a(ForthMachine.cpp.o)' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
  ld: warning: direct access in function 'pybind11::class_<awkward::ForthMachineOf<int, int>, std::__1::shared_ptr<awkward::ForthMachineOf<int, int> > > make_ForthMachineOf<int, int>(pybind11::handle const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)' from file '/tmp/lto.o' to global weak symbol 'awkward::ForthMachineOf<int, int>::is_ready() const' from file 'libawkward-static.a(ForthMachine.cpp.o)' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
  ld: warning: direct access in function 'pybind11::class_<awkward::ForthMachineOf<long long, int>, std::__1::shared_ptr<awkward::ForthMachineOf<long long, int> > > make_ForthMachineOf<long long, int>(pybind11::handle const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)' from file '/tmp/lto.o' to global weak symbol 'awkward::ForthMachineOf<long long, int>::is_segment_done() const' from file 'libawkward-static.a(ForthMachine.cpp.o)' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
  ld: warning: direct access in function 'pybind11::class_<awkward::ForthMachineOf<long long, int>, std::__1::shared_ptr<awkward::ForthMachineOf<long long, int> > > make_ForthMachineOf<long long, int>(pybind11::handle const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)' from file '/tmp/lto.o' to global weak symbol 'awkward::ForthMachineOf<long long, int>::is_segment_done() const' from file 'libawkward-static.a(ForthMachine.cpp.o)' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
  ld: warning: direct access in function 'pybind11::class_<awkward::ForthMachineOf<long long, int>, std::__1::shared_ptr<awkward::ForthMachineOf<long long, int> > > make_ForthMachineOf<long long, int>(pybind11::handle const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)' from file '/tmp/lto.o' to global weak symbol 'awkward::ForthMachineOf<long long, int>::is_done() const' from file 'libawkward-static.a(ForthMachine.cpp.o)' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
  ld: warning: direct access in function 'pybind11::class_<awkward::ForthMachineOf<long long, int>, std::__1::shared_ptr<awkward::ForthMachineOf<long long, int> > > make_ForthMachineOf<long long, int>(pybind11::handle const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)' from file '/tmp/lto.o' to global weak symbol 'awkward::ForthMachineOf<long long, int>::is_done() const' from file 'libawkward-static.a(ForthMachine.cpp.o)' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
  ld: warning: direct access in function 'pybind11::class_<awkward::ForthMachineOf<long long, int>, std::__1::shared_ptr<awkward::ForthMachineOf<long long, int> > > make_ForthMachineOf<long long, int>(pybind11::handle const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)' from file '/tmp/lto.o' to global weak symbol 'awkward::ForthMachineOf<long long, int>::is_ready() const' from file 'libawkward-static.a(ForthMachine.cpp.o)' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
  ld: warning: direct access in function 'pybind11::class_<awkward::ForthMachineOf<long long, int>, std::__1::shared_ptr<awkward::ForthMachineOf<long long, int> > > make_ForthMachineOf<long long, int>(pybind11::handle const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)' from file '/tmp/lto.o' to global weak symbol 'awkward::ForthMachineOf<long long, int>::is_ready() const' from file 'libawkward-static.a(ForthMachine.cpp.o)' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
  /Users/jpivarski/mambaforge/bin/arm64-apple-darwin20.0.0-strip: warning: changes being made to the file will invalidate the code signature in: /private/var/folders/38/rnl4wm1930j6m17jk5x5xfym0000gn/T/tmpluipg_8b/build/_ext.cpython-310-darwin.so

I don't see any compiler warnings or any warnings at all on Linux.

jpivarski avatar Nov 10 '22 23:11 jpivarski

Although it will be clearly better to have this done, it doesn't have to be done by the next release. It doesn't impact any APIs that have to remain stable thereafter.

jpivarski avatar Nov 29 '22 22:11 jpivarski

just as a reminder to myself - the warnings on MacOS in awkward-2.5.1rc1 are as follows:

In file included from /Users/yana/Projects/PR2818/awkward/awkward-cpp/src/libawkward/io/json.cpp:19:
  /Users/yana/Projects/PR2818/awkward/awkward-cpp/include/awkward/io/json.h:153:31: warning: implicit conversion changes signedness: 'int64_t' (aka 'long long') to 'std::vector<long long>::size_type' (aka 'unsigned long') [-Wsign-conversion]
          record_current_field_[argument2()]++;
          ~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~
  /Users/yana/Projects/PR2818/awkward/awkward-cpp/include/awkward/io/json.h:154:35: warning: implicit conversion changes signedness: 'int64_t' (aka 'long long') to 'std::vector<long long>::size_type' (aka 'unsigned long') [-Wsign-conversion]
          if (record_current_field_[argument2()] == argument1()) {
              ~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~
  /Users/yana/Projects/PR2818/awkward/awkward-cpp/include/awkward/io/json.h:155:33: warning: implicit conversion changes signedness: 'int64_t' (aka 'long long') to 'std::vector<long long>::size_type' (aka 'unsigned long') [-Wsign-conversion]
            record_current_field_[argument2()] = 0;
            ~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~
  /Users/yana/Projects/PR2818/awkward/awkward-cpp/include/awkward/io/json.h:157:35: warning: implicit conversion changes signedness: 'int64_t' (aka 'long long') to 'std::vector<long long>::size_type' (aka 'unsigned long') [-Wsign-conversion]
          j = record_current_field_[argument2()];
              ~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~
  /Users/yana/Projects/PR2818/awkward/awkward-cpp/include/awkward/io/json.h:166:49: warning: implicit conversion changes signedness: 'int64_t' (aka 'long long') to 'std::vector<unsigned long long>::size_type' (aka 'unsigned long') [-Wsign-conversion]
            if ((record_checklist_[argument2()][j >> 6] & chunkmask) == 0) {
                 ~~~~~~~~~~~~~~~~~              ~~^~~~
  /Users/yana/Projects/PR2818/awkward/awkward-cpp/include/awkward/io/json.h:166:34: warning: implicit conversion changes signedness: 'int64_t' (aka 'long long') to 'std::vector<std::vector<unsigned long long>>::size_type' (aka 'unsigned long') [-Wsign-conversion]
            if ((record_checklist_[argument2()][j >> 6] & chunkmask) == 0) {
                 ~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~
  /Users/yana/Projects/PR2818/awkward/awkward-cpp/include/awkward/io/json.h:170:44: warning: implicit conversion changes signedness: 'int64_t' (aka 'long long') to 'std::vector<unsigned long long>::size_type' (aka 'unsigned long') [-Wsign-conversion]
            record_checklist_[argument2()][j >> 6] &= ~chunkmask;
            ~~~~~~~~~~~~~~~~~              ~~^~~~
  /Users/yana/Projects/PR2818/awkward/awkward-cpp/include/awkward/io/json.h:170:29: warning: implicit conversion changes signedness: 'int64_t' (aka 'long long') to 'std::vector<std::vector<unsigned long long>>::size_type' (aka 'unsigned long') [-Wsign-conversion]
            record_checklist_[argument2()][j >> 6] &= ~chunkmask;
            ~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~
  /Users/yana/Projects/PR2818/awkward/awkward-cpp/include/awkward/io/json.h:177:67: warning: implicit conversion changes signedness: 'int64_t' (aka 'long long') to 'std::vector<long long>::size_type' (aka 'unsigned long') [-Wsign-conversion]
          if (i != current_instruction_ + 1 + record_current_field_[argument2()]) {
                                              ~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~
  /Users/yana/Projects/PR2818/awkward/awkward-cpp/include/awkward/io/json.h:184:35: warning: implicit conversion changes signedness: 'int64_t' (aka 'long long') to 'std::vector<long long>::size_type' (aka 'unsigned long') [-Wsign-conversion]
              record_current_field_[argument2()] = j;
              ~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~
  /Users/yana/Projects/PR2818/awkward/awkward-cpp/include/awkward/io/json.h:187:51: warning: implicit conversion changes signedness: 'int64_t' (aka 'long long') to 'std::vector<unsigned long long>::size_type' (aka 'unsigned long') [-Wsign-conversion]
              if ((record_checklist_[argument2()][j >> 6] & chunkmask) == 0) {
                   ~~~~~~~~~~~~~~~~~              ~~^~~~
  /Users/yana/Projects/PR2818/awkward/awkward-cpp/include/awkward/io/json.h:187:36: warning: implicit conversion changes signedness: 'int64_t' (aka 'long long') to 'std::vector<std::vector<unsigned long long>>::size_type' (aka 'unsigned long') [-Wsign-conversion]
              if ((record_checklist_[argument2()][j >> 6] & chunkmask) == 0) {
                   ~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~
  /Users/yana/Projects/PR2818/awkward/awkward-cpp/include/awkward/io/json.h:191:46: warning: implicit conversion changes signedness: 'int64_t' (aka 'long long') to 'std::vector<unsigned long long>::size_type' (aka 'unsigned long') [-Wsign-conversion]
              record_checklist_[argument2()][j >> 6] &= ~chunkmask;
              ~~~~~~~~~~~~~~~~~              ~~^~~~
  /Users/yana/Projects/PR2818/awkward/awkward-cpp/include/awkward/io/json.h:191:31: warning: implicit conversion changes signedness: 'int64_t' (aka 'long long') to 'std::vector<std::vector<unsigned long long>>::size_type' (aka 'unsigned long') [-Wsign-conversion]
              record_checklist_[argument2()][j >> 6] &= ~chunkmask;
              ~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~
  /Users/yana/Projects/PR2818/awkward/awkward-cpp/include/awkward/io/json.h:202:54: warning: implicit conversion changes signedness: 'int64_t' (aka 'long long') to 'std::vector<unsigned long long>::size_type' (aka 'unsigned long') [-Wsign-conversion]
        return (record_checklist_[record_identifier][j >> 6] & chunkmask) == 0;
                ~~~~~~~~~~~~~~~~~                    ~~^~~~
  /Users/yana/Projects/PR2818/awkward/awkward-cpp/include/awkward/io/json.h:202:33: warning: implicit conversion changes signedness: 'int64_t' (aka 'long long') to 'std::vector<std::vector<unsigned long long>>::size_type' (aka 'unsigned long') [-Wsign-conversion]
        return (record_checklist_[record_identifier][j >> 6] & chunkmask) == 0;
                ~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~
  /Users/yana/Projects/PR2818/awkward/awkward-cpp/include/awkward/io/json.h:215:34: warning: implicit conversion changes signedness: 'int64_t' (aka 'long long') to 'std::vector<std::vector<unsigned long long>>::size_type' (aka 'unsigned long') [-Wsign-conversion]
            record_checklist_init_[record_identifier].end()
            ~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~
  /Users/yana/Projects/PR2818/awkward/awkward-cpp/include/awkward/io/json.h:214:34: warning: implicit conversion changes signedness: 'int64_t' (aka 'long long') to 'std::vector<std::vector<unsigned long long>>::size_type' (aka 'unsigned long') [-Wsign-conversion]
            record_checklist_init_[record_identifier].begin(),
            ~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~
  /Users/yana/Projects/PR2818/awkward/awkward-cpp/include/awkward/io/json.h:213:25: warning: implicit conversion changes signedness: 'int64_t' (aka 'long long') to 'std::vector<std::vector<unsigned long long>>::size_type' (aka 'unsigned long') [-Wsign-conversion]
        record_checklist_[record_identifier].assign(
        ~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~
  /Users/yana/Projects/PR2818/awkward/awkward-cpp/include/awkward/io/json.h:223:47: warning: implicit conversion changes signedness: 'int64_t' (aka 'long long') to 'std::vector<std::vector<unsigned long long>>::size_type' (aka 'unsigned long') [-Wsign-conversion]
        for (uint64_t chunk : record_checklist_[record_identifier]) {
                              ~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~
  /Users/yana/Projects/PR2818/awkward/awkward-cpp/src/libawkward/io/json.cpp:1254:55: warning: implicit conversion changes signedness: 'std::vector<long long>::size_type' (aka 'unsigned long') to 'std::vector<long long>::value_type' (aka 'long long') [-Wsign-conversion]
          instructions_.push_back(record_current_field_.size());  // record identifier
                        ~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~^~~~~~
  /Users/yana/Projects/PR2818/awkward/awkward-cpp/src/libawkward/io/json.cpp:1260:46: warning: implicit conversion changes signedness: 'int64_t' (aka 'long long') to 'std::vector<unsigned long long>::size_type' (aka 'unsigned long') [-Wsign-conversion]
          std::vector<uint64_t> checklist_init(num_checklist_chunks, 0);
                                ~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~
  /Users/yana/Projects/PR2818/awkward/awkward-cpp/src/libawkward/io/json.cpp:1264:26: warning: implicit conversion changes signedness: 'int64_t' (aka 'long long') to 'std::vector<unsigned long long>::size_type' (aka 'unsigned long') [-Wsign-conversion]
            checklist_init[chunki] |= chunkmask;
            ~~~~~~~~~~~~~~ ^~~~~~
  23 warnings generated.

ianna avatar Dec 08 '23 10:12 ianna