Bug 70757 - Add plugin callbacks that run early enough to check for declarations using "bad" names
Summary: Add plugin callbacks that run early enough to check for declarations using "b...
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: plugins (show other bugs)
Version: 7.0
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-21 17:03 UTC by Jonathan Wakely
Modified: 2016-04-21 17:05 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Wakely 2016-04-21 17:03:35 UTC
I once tried to write a gcc plugin to check that libstdc++ was not defining any non-standard names outside the reserved namespace, but quickly realised that the plugin callbacks all happen too late, so that uninstantiated templates are never seen by the plugin.

I also wanted it to check for the list of identifiers that are in the reserved namespace, but need to be avoided in libstdc++ for other reasons, as documetented at https://gcc.gnu.org/onlinedocs/libstdc++/manual/source_code_style.html#coding_style.bad_identifiers

I would like a callback in the front-end so that names of decls could be checked, and ideally the same thing during preprocessing so that macros can also be checked.

This would help avoid/find bugs like PR 70727 and PR 64135, and would also allow users to write the opposite plugin, to check that user code doesn't define anything using reserved names, solving PR 51437.

See also https://gcc.gnu.org/ml/gcc/2016-04/msg00200.html