Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#6416 closed Bugs (fixed)

Use attribute names with underscores for GCC

Reported by: Petr Machata <pmachata@…> Owned by: Eric Niebler
Milestone: To Be Determined Component: accumulator
Version: Boost 1.48.0 Severity: Problem
Keywords: Cc:

Description

... which should prevent accidental interactions between user-defined macros and boost internals.

Attachments (1)

boost-accumulators.patch (1.2 KB ) - added by Petr Machata <pmachata@…> 11 years ago.

Download all attachments as: .zip

Change History (5)

by Petr Machata <pmachata@…>, 11 years ago

Attachment: boost-accumulators.patch added

comment:1 by Eric Niebler, 11 years ago

Can you point to official gcc documentation that show that this is a supported and equivalent syntax? All I see is here: http://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html, which seems to indicate that the original code is the correct form. And if the form you suggested is allowed, then is it only a recent addition?

comment:2 by Eric Niebler, 11 years ago

Resolution: invalid
Status: newclosed

Resolving as invalid for now. If you can show that this has been supported syntax for a long time, feel free to reopen.

comment:3 by Petr Machata <pmachata@…>, 11 years ago

Curiously, no, I can't, it doesn't seem to be documented, but it's been supported since "forever". It's used internally by stdlibc++, and boost even uses this syntax in a couple places (move, type traits). With GCC 3.3, which is the oldest that I have around, I'm getting this:

  __attribute__ ((__noinline__)) int ble() { return 10; } // passes quietly
  __attribute__ ((__sdkfljlk__)) int ble2() { return 10; } // gives warning

(Hopefully I typed this correctly, the machine that I tested this on is not networked.)

The code in boost is not incorrect, it just lends itself easier to user-defined macros. The underscore syntax is supported by GCC to remedy this. Please consider applying the patch.

comment:4 by Eric Niebler, 11 years ago

Resolution: invalidfixed

(In [76637]) Use attribute names with underscores for GCC, fixes #6416

Note: See TracTickets for help on using tickets.