This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Suppress pedwarn for use of statics in non-static inline functions for statics from system headers (PR c/34000)


The attached patch fixes c/34000.

The current gcc trunk pedwarns unconditionally about the use of any
non-const statics in non-static inline functions in C, as doing so is a
constraint violation in C99 (6.7.4).

However, it's fairly common for system header files to declare inline
functions as "static inline", presumably because it avoids having to
handle the differences in inlining between GNU89 and C99.  Indeed, gcc
itself does this in the <mmintrin.h> family of MMX/SSE intrinsic
wrappers on X86.

As a result, using any of these system functions in non-static inlines
causes unconditional warnings.

The attached patch suppresses the pedwarn for declarations from system
headers unless warn_system_headers is set.

(Note that I do not have a copyright assignment; however, this is a
one-line patch other than the test cases, so it should be under the
limit.)

-- 
Jonathan Lennox
Vidyo, Inc (formerly Layered Media)
jonathan at vidyo dot com

Attachment: gcc-static.diff.txt
Description: gcc-static.diff.txt


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]