cellml / libcellml

Repository for libCellML development.
https://libcellml.org
Apache License 2.0
16 stars 21 forks source link

Make gcc 11.3.0 happy on Ubuntu 22.04 LTS #1152

Closed agarny closed 1 year ago

agarny commented 1 year ago

Right now, if I try to build libCellML on Ubuntu 22.04 LTS (i.e. with gcc 11.3.0), I get the following errors:

[6/164] Building CXX object tests/gtest/CMakeFiles/gtest.dir/src/gtest-all.cc.o
/home/alan/libCellML/tests/gtest/src/gtest-all.cc: In function ‘bool testing::internal::StackGrowsDown()’:
/home/alan/libCellML/tests/gtest/src/gtest-all.cc:8681:24: warning: ‘dummy’ may be used uninitialized [-Wmaybe-uninitialized]
 8681 |   StackLowerThanAddress(&dummy, &result);
      |   ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/home/alan/libCellML/tests/gtest/src/gtest-all.cc:8671:13: note: by argument 1 of type ‘const void*’ to ‘void testing::internal::StackLowerThanAddress(const void*, bool*)’ declared here
 8671 | static void StackLowerThanAddress(const void* ptr, bool* result) {
      |             ^~~~~~~~~~~~~~~~~~~~~
/home/alan/libCellML/tests/gtest/src/gtest-all.cc:8679:7: note: ‘dummy’ declared here
 8679 |   int dummy;
      |       ^~~~~
[10/164] Building CXX object src/CMakeFiles/cellml.dir/componententity.cpp.o
FAILED: src/CMakeFiles/cellml.dir/componententity.cpp.o 
/usr/bin/buildcache /usr/bin/c++ -Dcellml_EXPORTS -I/home/alan/libCellML/build/src/api -I/home/alan/libCellML/src/api -I/home/alan/libCellML/src/api/libcellml/module -I/home/alan/libCellML/build/src -I/usr/include/libxml2 -g -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -fprofile-arcs -ftest-coverage -Wall -W -Werror -MD -MT src/CMakeFiles/cellml.dir/componententity.cpp.o -MF src/CMakeFiles/cellml.dir/componententity.cpp.o.d -o src/CMakeFiles/cellml.dir/componententity.cpp.o -c /home/alan/libCellML/src/componententity.cpp
In file included from /home/alan/libCellML/src/component_p.h:22,
                 from /home/alan/libCellML/src/componententity.cpp:27:
/home/alan/libCellML/src/utilities.h:40:39: error: ‘numeric_limits’ is not a member of ‘std’
   40 | static const size_t MAX_SIZE_T = std::numeric_limits<size_t>::max();
      |                                       ^~~~~~~~~~~~~~
/home/alan/libCellML/src/utilities.h:40:60: error: expected primary-expression before ‘>’ token
   40 | static const size_t MAX_SIZE_T = std::numeric_limits<size_t>::max();
      |                                                            ^
/home/alan/libCellML/src/utilities.h:40:63: error: ‘::max’ has not been declared; did you mean ‘std::max’?
   40 | static const size_t MAX_SIZE_T = std::numeric_limits<size_t>::max();
      |                                                               ^~~
      |                                                               std::max
In file included from /usr/include/c++/11/algorithm:62,
                 from /home/alan/libCellML/src/componententity.cpp:19:
/usr/include/c++/11/bits/stl_algo.h:3467:5: note: ‘std::max’ declared here
 3467 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
[11/164] Building CXX object src/CMakeFiles/cellml.dir/analyserexternalvariable.cpp.o
FAILED: src/CMakeFiles/cellml.dir/analyserexternalvariable.cpp.o 
/usr/bin/buildcache /usr/bin/c++ -Dcellml_EXPORTS -I/home/alan/libCellML/build/src/api -I/home/alan/libCellML/src/api -I/home/alan/libCellML/src/api/libcellml/module -I/home/alan/libCellML/build/src -I/usr/include/libxml2 -g -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -fprofile-arcs -ftest-coverage -Wall -W -Werror -MD -MT src/CMakeFiles/cellml.dir/analyserexternalvariable.cpp.o -MF src/CMakeFiles/cellml.dir/analyserexternalvariable.cpp.o.d -o src/CMakeFiles/cellml.dir/analyserexternalvariable.cpp.o -c /home/alan/libCellML/src/analyserexternalvariable.cpp
In file included from /home/alan/libCellML/src/analyserexternalvariable.cpp:22:
/home/alan/libCellML/src/utilities.h:40:39: error: ‘numeric_limits’ is not a member of ‘std’
   40 | static const size_t MAX_SIZE_T = std::numeric_limits<size_t>::max();
      |                                       ^~~~~~~~~~~~~~
/home/alan/libCellML/src/utilities.h:40:60: error: expected primary-expression before ‘>’ token
   40 | static const size_t MAX_SIZE_T = std::numeric_limits<size_t>::max();
      |                                                            ^
/home/alan/libCellML/src/utilities.h:40:63: error: ‘::max’ has not been declared; did you mean ‘std::max’?
   40 | static const size_t MAX_SIZE_T = std::numeric_limits<size_t>::max();
      |                                                               ^~~
      |                                                               std::max
In file included from /usr/include/c++/11/algorithm:62,
                 from /home/alan/libCellML/src/utilities.h:19,
                 from /home/alan/libCellML/src/analyserexternalvariable.cpp:22:
/usr/include/c++/11/bits/stl_algo.h:3467:5: note: ‘std::max’ declared here
 3467 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
[12/164] Building CXX object src/CMakeFiles/cellml.dir/analysermodel.cpp.o
FAILED: src/CMakeFiles/cellml.dir/analysermodel.cpp.o 
/usr/bin/buildcache /usr/bin/c++ -Dcellml_EXPORTS -I/home/alan/libCellML/build/src/api -I/home/alan/libCellML/src/api -I/home/alan/libCellML/src/api/libcellml/module -I/home/alan/libCellML/build/src -I/usr/include/libxml2 -g -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -fprofile-arcs -ftest-coverage -Wall -W -Werror -MD -MT src/CMakeFiles/cellml.dir/analysermodel.cpp.o -MF src/CMakeFiles/cellml.dir/analysermodel.cpp.o.d -o src/CMakeFiles/cellml.dir/analysermodel.cpp.o -c /home/alan/libCellML/src/analysermodel.cpp
In file included from /home/alan/libCellML/src/analysermodel.cpp:20:
/home/alan/libCellML/src/utilities.h:40:39: error: ‘numeric_limits’ is not a member of ‘std’
   40 | static const size_t MAX_SIZE_T = std::numeric_limits<size_t>::max();
      |                                       ^~~~~~~~~~~~~~
/home/alan/libCellML/src/utilities.h:40:60: error: expected primary-expression before ‘>’ token
   40 | static const size_t MAX_SIZE_T = std::numeric_limits<size_t>::max();
      |                                                            ^
/home/alan/libCellML/src/utilities.h:40:63: error: ‘::max’ has not been declared; did you mean ‘std::max’?
   40 | static const size_t MAX_SIZE_T = std::numeric_limits<size_t>::max();
      |                                                               ^~~
      |                                                               std::max
In file included from /usr/include/c++/11/algorithm:62,
                 from /home/alan/libCellML/src/utilities.h:19,
                 from /home/alan/libCellML/src/analysermodel.cpp:20:
/usr/include/c++/11/bits/stl_algo.h:3467:5: note: ‘std::max’ declared here
 3467 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
[14/164] Building CXX object src/CMakeFiles/cellml.dir/component.cpp.o
FAILED: src/CMakeFiles/cellml.dir/component.cpp.o 
/usr/bin/buildcache /usr/bin/c++ -Dcellml_EXPORTS -I/home/alan/libCellML/build/src/api -I/home/alan/libCellML/src/api -I/home/alan/libCellML/src/api/libcellml/module -I/home/alan/libCellML/build/src -I/usr/include/libxml2 -g -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -fprofile-arcs -ftest-coverage -Wall -W -Werror -MD -MT src/CMakeFiles/cellml.dir/component.cpp.o -MF src/CMakeFiles/cellml.dir/component.cpp.o.d -o src/CMakeFiles/cellml.dir/component.cpp.o -c /home/alan/libCellML/src/component.cpp
In file included from /home/alan/libCellML/src/component_p.h:22,
                 from /home/alan/libCellML/src/component.cpp:30:
/home/alan/libCellML/src/utilities.h:40:39: error: ‘numeric_limits’ is not a member of ‘std’
   40 | static const size_t MAX_SIZE_T = std::numeric_limits<size_t>::max();
      |                                       ^~~~~~~~~~~~~~
/home/alan/libCellML/src/utilities.h:40:60: error: expected primary-expression before ‘>’ token
   40 | static const size_t MAX_SIZE_T = std::numeric_limits<size_t>::max();
      |                                                            ^
/home/alan/libCellML/src/utilities.h:40:63: error: ‘::max’ has not been declared; did you mean ‘std::max’?
   40 | static const size_t MAX_SIZE_T = std::numeric_limits<size_t>::max();
      |                                                               ^~~
      |                                                               std::max
In file included from /usr/include/c++/11/algorithm:62,
                 from /home/alan/libCellML/src/component.cpp:19:
/usr/include/c++/11/bits/stl_algo.h:3467:5: note: ‘std::max’ declared here
 3467 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
[15/164] Building CXX object src/CMakeFiles/cellml.dir/annotator.cpp.o
FAILED: src/CMakeFiles/cellml.dir/annotator.cpp.o 
/usr/bin/buildcache /usr/bin/c++ -Dcellml_EXPORTS -I/home/alan/libCellML/build/src/api -I/home/alan/libCellML/src/api -I/home/alan/libCellML/src/api/libcellml/module -I/home/alan/libCellML/build/src -I/usr/include/libxml2 -g -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -fprofile-arcs -ftest-coverage -Wall -W -Werror -MD -MT src/CMakeFiles/cellml.dir/annotator.cpp.o -MF src/CMakeFiles/cellml.dir/annotator.cpp.o.d -o src/CMakeFiles/cellml.dir/annotator.cpp.o -c /home/alan/libCellML/src/annotator.cpp
In file included from /home/alan/libCellML/src/annotator.cpp:38:
/home/alan/libCellML/src/utilities.h:40:39: error: ‘numeric_limits’ is not a member of ‘std’
   40 | static const size_t MAX_SIZE_T = std::numeric_limits<size_t>::max();
      |                                       ^~~~~~~~~~~~~~
/home/alan/libCellML/src/utilities.h:40:60: error: expected primary-expression before ‘>’ token
   40 | static const size_t MAX_SIZE_T = std::numeric_limits<size_t>::max();
      |                                                            ^
/home/alan/libCellML/src/utilities.h:40:63: error: ‘::max’ has not been declared; did you mean ‘std::max’?
   40 | static const size_t MAX_SIZE_T = std::numeric_limits<size_t>::max();
      |                                                               ^~~
      |                                                               std::max
In file included from /usr/include/c++/11/algorithm:62,
                 from /home/alan/libCellML/src/annotator.cpp:19:
/usr/include/c++/11/bits/stl_algo.h:3467:5: note: ‘std::max’ declared here
 3467 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
ninja: build stopped: subcommand failed.