boostorg / assert Goto Github PK
View Code? Open in Web Editor NEWBoost.Assert
Boost.Assert
boost: 1.80.0
android ndk: r16b
clang version: 5.0.300080
message:
use of undeclared identifier '__builtin_FUNCTION'
note: expanded from macro 'BOOST_CURRENT_LOCATION'
I am not sure what the test is actually testing, but it is printing a scary message.
I am building Boost 1.83.0 with CMake and the Intel LLVM compiler (version 2024.0.0).
Everything builds fine, but I get the following test failures:
The following tests FAILED:
13 - run-boost_assert-source_location_test (Failed)
15 - run-boost_assert-source_location_test3 (Failed)
16 - run-boost_assert-source_location_test4 (Failed)
1480 - run-boost_throw_exception-throw_exception_test4 (Failed)
(The last failure appears unrelated, but the log will show otherwise.)
Note that I had previously compiled this same version of Boost with an earlier version of Intel LLVM, and did not get these failures then, so there may be something in the behavior of the new compiler that is at fault.
Below are the test outputs. Note that the source tree is in /home/src/boost/1.83.0/
, and the build tree is at /tmp/boost-1.83.0-work/build
.
13/1661 Testing: run-boost_assert-source_location_test
13/1661 Test: run-boost_assert-source_location_test
Command: "/tmp/boost-1.83.0-work/build/stage/bin/boost_assert-source_location_test"
Directory: /tmp/boost-1.83.0-work/build/libs/assert/test
"run-boost_assert-source_location_test" start time: Nov 28 02:37 UTC
Output:
----------------------------------------------------------
/home/src/boost/1.83.0/libs/assert/test/source_location_test.cpp(40): test 'loc.file_name() == __FILE__' ('source_location_test.cpp' == '/home/src/boost/1.83.0/libs/assert/test/source_location_test.cpp') failed in function 'int main()'
/home/src/boost/1.83.0/libs/assert/test/source_location_test.cpp(47): test 'loc.file_name() == __FILE__' ('source_location_test.cpp' == '/home/src/boost/1.83.0/libs/assert/test/source_location_test.cpp') failed in function 'int main()'
2 errors detected.
<end of output>
Test time = 0.00 sec
----------------------------------------------------------
Test Failed.
"run-boost_assert-source_location_test" end time: Nov 28 02:37 UTC
"run-boost_assert-source_location_test" time elapsed: 00:00:00
15/1661 Testing: run-boost_assert-source_location_test3
15/1661 Test: run-boost_assert-source_location_test3
Command: "/tmp/boost-1.83.0-work/build/stage/bin/boost_assert-source_location_test3"
Directory: /tmp/boost-1.83.0-work/build/libs/assert/test
"run-boost_assert-source_location_test3" start time: Nov 28 02:37 UTC
Output:
----------------------------------------------------------
/home/src/boost/1.83.0/libs/assert/test/source_location_test3.cpp(65): test 'loc.to_string().substr( 0, prefix.size() ) == prefix' ('source_location_test3.cpp:62:38 in function 'main'' == '/home/src/boost/1.83.0/libs/assert/test/source_location_test3.cpp:62') failed in function 'int main()'
1 error detected.
<end of output>
Test time = 0.00 sec
----------------------------------------------------------
Test Failed.
"run-boost_assert-source_location_test3" end time: Nov 28 02:37 UTC
"run-boost_assert-source_location_test3" time elapsed: 00:00:00
6/1661 Testing: run-boost_assert-source_location_test4
16/1661 Test: run-boost_assert-source_location_test4
Command: "/tmp/boost-1.83.0-work/build/stage/bin/boost_assert-source_location_test4"
Directory: /tmp/boost-1.83.0-work/build/libs/assert/test
"run-boost_assert-source_location_test4" start time: Nov 28 02:37 UTC
Output:
----------------------------------------------------------
/home/src/boost/1.83.0/libs/assert/test/source_location_test4.cpp(21): test 's_loc.file_name() == __FILE__' ('source_location_test4.cpp' == '/home/src/boost/1.83.0/libs/assert/test/source_location_test4.cpp') failed in function 'int main()'
/home/src/boost/1.83.0/libs/assert/test/source_location_test4.cpp(32): test 'c_loc.file_name() == __FILE__' ('source_location_test4.cpp' == '/home/src/boost/1.83.0/libs/assert/test/source_location_test4.cpp') failed in function 'int main()'
/home/src/boost/1.83.0/libs/assert/test/source_location_test4.cpp(39): test 'loc.file_name() == __FILE__' ('source_location_test4.cpp' == '/home/src/boost/1.83.0/libs/assert/test/source_location_test4.cpp') failed in function 'int main()'
3 errors detected.
<end of output>
Test time = 0.00 sec
----------------------------------------------------------
Test Failed.
"run-boost_assert-source_location_test4" end time: Nov 28 02:37 UTC
"run-boost_assert-source_location_test4" time elapsed: 00:00:00
1480/1661 Testing: run-boost_throw_exception-throw_exception_test4
1480/1661 Test: run-boost_throw_exception-throw_exception_test4
Command: "/tmp/boost-1.83.0-work/build/stage/bin/boost_throw_exception-throw_exception_test4"
Directory: /tmp/boost-1.83.0-work/build/libs/throw_exception/test
"run-boost_throw_exception-throw_exception_test4" start time: Nov 28 02:44 UTC
Output:
----------------------------------------------------------
/home/src/boost/1.83.0/libs/throw_exception/test/throw_exception_test4.cpp(43): test '*file == __FILE__' ('throw_exception_test4.cpp' == '/home/src/boost/1.83.0/libs/throw_exception/test/throw_exception_test4.cpp') failed in function 'int main()'
/home/src/boost/1.83.0/libs/throw_exception/test/throw_exception_test4.cpp(71): test '*file == __FILE__' ('throw_exception_test4.cpp' == '/home/src/boost/1.83.0/libs/throw_exception/test/throw_exception_test4.cpp') failed in function 'int main()'
/home/src/boost/1.83.0/libs/throw_exception/test/throw_exception_test4.cpp(99): test '*file == __FILE__' ('throw_exception_test4.cpp' == '/home/src/boost/1.83.0/libs/throw_exception/test/throw_exception_test4.cpp') failed in function 'int main()'
3 errors detected.
<end of output>
Test time = 0.00 sec
----------------------------------------------------------
Test Failed.
"run-boost_throw_exception-throw_exception_test4" end time: Nov 28 02:44 UTC
"run-boost_throw_exception-throw_exception_test4" time elapsed: 00:00:00
When I tried to compile PCL(PointCloudLibrary) with the Boost file compiled by myself, the error showed that #if #endif pairs did not match and the error was reported in the assert.hpp file from Boost, so I checked the file in VS2022 and didn't see any error prompt. I have compared the latest version of Boost compiled files, and every line is the same. (Because it is necessary to compile part of the code with NVCC, NVCC always prompts that the *.hpp file of Boost cannot be found. Even though I have completely set it in path and CMake, I changed the include directory to a pure English absolute path, but I think this should not be the reason. ) I hope to get an answer, thank you very much!
My platform: Windows11
Compiler: vs2022 (or vc143) & nvcc (from cuda 11.6)
Currently, the documentation does not mention any requirements on the user-defined assertion_failed(_msg)
functions beyond their signatures. However, at least the requirement that these functions should not return (normally) should be documented.
One particular question I have is are these functions allowed to throw? This would affect whether BOOST_ASSERT(_MSG)
can be used in noexcept
functions, for example.
====== BEGIN OUTPUT ======
libs/assert: error: directory not found; Missing [project-root]/doc directory. The [project-root]/doc directory is required for all libraries. Sources to build with and built documentation for the library. If the library needs to build documentation from non-HTML files this location must be buildable with Boost Build.
EXIT STATUS: 1
====== END OUTPUT ======
The documentation for BOOST_CURRENT_FUNCTION
says:
BOOST_CURRENT_FUNCTION
expands to a string literal [...]
Under GCC (among others), it gets defined to __PRETTY_FUNCTION__
, which is not a string literal.
These identifiers are variables, not preprocessor macros, and may not be used to initialize
char
arrays or be concatenated with string literals.
Here's a minimal example program:
#include <boost/current_function.hpp>
int main(){
static const char * str1 = "in function " "main";
static const char * str2 = "in function " BOOST_CURRENT_FUNCTION;
}
Since most major compilers don't provide a macro that expands to a string literal with the name of the current function, let alone the signature, I suggest changing the documentation to reflect the type of BOOST_CURRENT_FUNCTION
. (MSVC is the major exception, it seems)
Would it be reasonable and possible to move current_function.hpp
to Boost.Config or Boost.Core
as a bit more general purpose feature than just for assertion macros? /cc @pdimov
The docs with embedded example code for BOOST_ASSERT_IS_VOID
refer to BOOST_ASSERT_IS_EMPTY
, which I imagine might be an earlier name for the same functionality - see abf5a45#commitcomment-19634133
https://godbolt.org/z/Pboz77Ysn, as reported in chriskohlhoff/asio#1089.
Compiling my code on Linux with release 12.1, V12.1.105 / gcc 11.3.0 fails with the following errors:
/build_deps/boost_1_81_0/include/boost/throw_exception.hpp(224): error: call to consteval function "std::source_location::current" did not produce a valid constant expression
template<class E> __attribute__ ((__noreturn__)) void throw_with_location( E && e, boost::source_location const & loc = ::boost::source_location(::std::source_location::current()) )
^
/build_deps/gcc-11.3.0/include/c++/11.3.0/source_location(51): note #2703-D: cannot call non-constexpr function "__builtin_source_location" (declared implicitly)
current(const void* __p = __builtin_source_location()) noexcept
^
I have hit this with both boost 1.81.0 and 1.82.0. I haven't tried with other compilers (gcc versions or clang) or nvcc.
I have been able to track this back to boost/assert/source_location.hpp
, where a similar issue is mentioned for some versions of MSVC. I'm submitting a simple patch that works around the issue.
We are in the process of making B2 build changes to all of the B2 build files
to support "modular" consumption of the Boost Libraries by users. See this list
post for some details: https://lists.boost.org/Archives/boost/2024/01/255704.php
The process requires making a variety of changes to make each Boost library
independent of the super-project structure. But the changes do not remove the
super-project structure or the comprehensive Boost release. The changes make
solely make it possible, optionally, for users, like package manages, to easily
consume libraries individually.
Generally the changes include:
Some examples of such changes:
We are asking how you would like us to handle the changes. We would prefer if
you allow the owners of the Boost.org GitHub project to make changes to B2
build files, as needed, to accomplish the changes. But understand
that you may want to manage the proposed changes yourself.
We previously sent emails to all known maintainers to fill out a form with their
preference. We are contacting you in this issue as we have not gotten a response
to that email. You can see the ongoing responses for that form and the responses
to these issues here https://github.com/users/grafikrobot/projects/1/views/6
We are now asking if you can reply directly to this issue to indicate your
preference of handling the changes. Please supply a response to this question
and close the issue (so that we can verify you are a maintainer).
How would you like the build changes to be processed?
Also please indicate any special instructions you want us to consider. Or other
information you want us to be aware of.
Thanks you, René
Every library module should have a 'index.html' file in its root directory, so that it can be easily linked on the website. You could just move 'assert.html' to 'index.html', or add a redirect file, or something else if you prefer.
Hi!
Hi! libintl (part of gettext) #defines sprintf into libintl_sprintf (cf https://github.com/autotools-mirror/gettext/blob/c438dbf70dd293fa099e94d8fb964cd133675b5f/gettext-runtime/intl/libgnuintl.in.h#L394 - since 19 years ago
apparently), which creates compilation issues with latest boost, because since
1f98fab#diff there is a std::sprintf
which creates compilation errors in localized programs using boost on mingw64. This in particular affects Inkscape because of course 'libintl_sprintf' is not a member of 'std' (e.g. https://gitlab.com/inkscape/inkscape/-/jobs/1893141019 ) …
is there a way that you could remove the std:: in boost assert ?
Thanks :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.