Bug 59851 - Support sparse-style __attribute__((nocast)) (type attribute)
Summary: Support sparse-style __attribute__((nocast)) (type attribute)
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: unknown
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks: sparse
  Show dependency treegraph
 
Reported: 2014-01-17 05:22 UTC by H. Peter Anvin
Modified: 2022-09-23 12:36 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
Example source file (161 bytes, text/x-csrc)
2014-01-17 05:22 UTC, H. Peter Anvin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description H. Peter Anvin 2014-01-17 05:22:32 UTC
Created attachment 31862 [details]
Example source file

The sparse static C language checker has a type attribute

__attribute__((nocast))

... which issues a warning if a type is implicitly converted unless it is exactly the same type (changes in constness is permitted, presumably changes in volatility *should* be permitted as well).

The attached example file produces:

nocast.c:11:24: warning: implicit cast to nocast type
nocast.c:23:24: warning: implicit cast to nocast type