This is the mail archive of the gcc-bugs@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]

[Bug c/17426] New: Emit mandatory warning for manual expansions of offsetof


RTH's patch for PR 17396 reintroduced support for the old-skool manual 
expansion of offsetof within constant expression - a thing which is forbidden 
by C90 rules and that we will stop accepting one day.

Meanwhile, it makes sense to warn people about this change, since it is a 
widespread idiom. I propose a mandatory warning to be emitted in this case:

warning: this custom definition of offsetof is not a valid constant expression 
in ISO C
info: use the offsetof macro from <stddef.h> to disable this warning

JSM, I would appreciate your comments on this PR (especially, the wording of 
the message, pedwarn vs warn, mandatory or not), before I write up the patch.

-- 
           Summary: Emit mandatory warning for manual expansions of offsetof
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: giovannibajo at libero dot it
        ReportedBy: giovannibajo at libero dot it
                CC: gcc-bugs at gcc dot gnu dot org,jsm28 at gcc dot gnu dot
                    org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17426


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