Page MenuHomeFreeBSD

Remove struct __hack from all files.
AbandonedPublic

Authored by rpaulo on Jun 30 2015, 11:41 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Apr 14, 5:38 AM
Unknown Object (File)
Dec 20 2023, 5:48 AM
Unknown Object (File)
Nov 19 2023, 3:43 PM
Unknown Object (File)
Nov 19 2023, 3:26 PM
Unknown Object (File)
Nov 11 2023, 2:28 PM
Unknown Object (File)
Nov 11 2023, 12:07 PM
Unknown Object (File)
Nov 5 2023, 10:37 AM
Unknown Object (File)
Oct 10 2023, 1:28 PM
Subscribers
None

Details

Summary

This was used to allow semi-colons at the end of some macros, but all
the compilers can now handle semi-colons after structures and they can
also ignore extra semi-colons.

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage

Event Timeline

rpaulo retitled this revision from to Remove struct __hack from all files..
rpaulo updated this object.
rpaulo edited the test plan for this revision. (Show Details)
rpaulo added reviewers: kib, jhb, neel, dchagin, jchandra.

Hmm, at least in atomic.h, the struct hack is not about compiler which is unable to handle ';' after structures (do such compiler ever existed ?). In atomic.h, the struct hack is used in macros which provide function definitions, to still allow to put semicolon after the macro. With your patch, the macro uses must very carefully avoid putting the ';' at the end of macro instantiations, which probably would confuse syntax-checking editors.

Also, I strongly recommend to mail the patch to bde, on the assumption that you would get a mail from him after the commit, anyway.

sys/amd64/include/atomic.h
128

There are at least two more instances of the struct __hack in the file.

In D2967#58058, @kib wrote:

Hmm, at least in atomic.h, the struct hack is not about compiler which is unable to handle ';' after structures (do such compiler ever existed ?). In atomic.h, the struct hack is used in macros which provide function definitions, to still allow to put semicolon after the macro. With your patch, the macro uses must very carefully avoid putting the ';' at the end of macro instantiations, which probably would confuse syntax-checking editors.

The problem is that there are plenty of other macros in the system that already behave that way. struct __hack is not really consistent in this area because the compiler will never emit a warning unless -Wextra-semi is used (and maybe -Weverything).