https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70757
Bug ID: 70757 Summary: Add plugin callbacks that run early enough to check for declarations using "bad" names Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: plugins Assignee: unassigned at gcc dot gnu.org Reporter: redi at gcc dot gnu.org Target Milestone: --- 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