Project

General

Profile

Actions

Bug #3373

closed

gcc >= 4.5 concerns about offsetof()

Added by Igor Pashev over 9 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Start date:
2012-11-18
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:

Description

In UTS sources offsetof() is defined as

#define    offsetof(s, m)  ((size_t)(&((s *)0)->m))

and used when defining static arrays, e. g.:
https://github.com/illumos/illumos-gate/blob/master/usr/src/uts/i86pc/os/fakebop.c#L147
https://github.com/illumos/illumos-gate/blob/master/usr/src/uts/i86pc/sys/fastboot.h#L70

gcc >= 4.5 will no accept it and will produce a warning:

warning: variably modified ‘saved_drives’ at file scope

This warning is lethal with Werror ;)

__builtin_offsetof() works here without a warning.


Files


Related issues

Related to illumos gate - Bug #3062: illumos should build/work with GCC 4.6 or newerResolvedToomas Soome2012-08-07

Actions
Has duplicate illumos gate - Bug #5457: Variably modified at file scopeClosed2014-12-21

Actions
Actions

Also available in: Atom PDF