Opened 10 years ago

Closed 10 years ago

Last modified 8 years ago

#7094 closed Bugs (fixed)

warning: unrecognized #pragma GCC system_header

Reported by: 1czajnik@… Owned by: Emil Dotchevski
Milestone: To Be Determined Component: exception
Version: Boost 1.50.0 Severity: Problem
Keywords: Cc:

Description

Hello,

Below is a list of files, that contain something like:

#if defined(__GNUC__)
#pragma GCC system_header
#endif

which causes a warning on my TI compiler.

boost\exception\all.hpp
boost\exception\current_exception_cast.hpp
boost\exception\detail\error_info_impl.hpp
boost\exception\detail\exception_ptr.hpp
boost\exception\detail\is_output_streamable.hpp
boost\exception\detail\object_hex_dump.hpp
boost\exception\detail\type_info.hpp
boost\exception\diagnostic_information.hpp
boost\exception\errinfo_errno.hpp
boost\exception\exception.hpp
boost\exception\get_error_info.hpp
boost\exception\info.hpp
boost\exception\info_tuple.hpp
boost\exception\to_string.hpp
boost\exception\to_string_stub.hpp
boost\throw_exception.hpp

In other files, i.e. boost\integer.hpp, I've found this #pragma guarded against __GNUC__ >= 4:

#if defined(__GNUC__) && (__GNUC__ >= 4)
#pragma GCC system_header
#endif

which doesn't cause a warning on my compiler, because it defines __GNUC__=3.

Could this be fixed in the files on the list above, or are there some __GNUC__=3 compilers, that need this pragma to be enabled?

Regards, Kris

Change History (6)

comment:1 by anonymous, 10 years ago

Thanks for reporting this bug. Could you please tell me the value of GNUC_MINOR for your compiler?

in reply to:  1 comment:2 by 1czajnik@…, 10 years ago

Replying to anonymous:

Thanks for reporting this bug. Could you please tell me the value of __GNUC_MINOR__ for your compiler?

Sure, __GNUC_MINOR__ is defined to 0 for this TI compiler.

Cheers, Kris

comment:3 by Emil Dotchevski, 10 years ago

Resolution: fixed
Status: newclosed

Fixed in trunk revision 79398

comment:4 by 1czajnik@…, 10 years ago

Thanks for fixing this, Emil. I took a look at 79398, and I think this should work for my compiler. But one thing came to my mind: what about compilers, that don't define __GNUC__ at all?

I mean, don't we need some additional guards like:

#if defined(__GNUC__) && defined(__GNUC_MINOR__) && \
    (__GNUC__*100+__GNUC_MINOR__>301) && \
    !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)

in reply to:  4 comment:5 by 1czajnik@…, 10 years ago

Replying to 1czajnik@…:

Thanks for fixing this, Emil. I took a look at 79398, and I think this should work for my compiler. But one thing came to my mind: what about compilers, that don't define __GNUC__ at all?

I mean, don't we need some additional guards like:

#if defined(__GNUC__) && defined(__GNUC_MINOR__) && \
    (__GNUC__*100+__GNUC_MINOR__>301) && \
    !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)

False alarm, I just checked in MinGW, that something like:

#if (asdf*100+ghjk > 5)
#error
#endif

compiles fine without asdf or ghjk defined. I didn't know the preprocessor was supposed to work like this ;-) Cheers

comment:6 by wojciech.migda@…, 8 years ago

Can you please fix it in static_assert.hpp as well? TI DSP compiler complains about undefined pragma there:

#if defined(GNUC) && !defined(GXX_EXPERIMENTAL_CXX0X) This is horrible, but it seems to be the only we can shut up the "anonymous variadic macros were introduced in C99 [-Wvariadic-macros]" warning that get spewed out otherwise in non-C++11 mode. #pragma GCC system_header #endif

I am using TI DSP C++ 7.3.5 and Boost 1.56. Should I report a separate ticket for this?

Thanks, Wojciech

Note: See TracTickets for help on using tickets.