public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug preprocessor/36887] Please report #pragma GCC poison" location
       [not found] <bug-36887-4@http.gcc.gnu.org/bugzilla/>
@ 2021-08-29 21:47 ` pinskia at gcc dot gnu.org
  2023-10-02 20:05 ` lhyatt at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-29 21:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36887

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Simplified testcase:
#pragma GCC poison a
int a;


GCC outputs:
<source>:2:5: error: attempt to use poisoned "a"
    2 | int a;
      |     ^

But not the location of the #pragma which would be useful to debug why it was
poisoned.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug preprocessor/36887] Please report #pragma GCC poison" location
       [not found] <bug-36887-4@http.gcc.gnu.org/bugzilla/>
  2021-08-29 21:47 ` [Bug preprocessor/36887] Please report #pragma GCC poison" location pinskia at gcc dot gnu.org
@ 2023-10-02 20:05 ` lhyatt at gcc dot gnu.org
  2023-10-23 23:17 ` cvs-commit at gcc dot gnu.org
  2023-10-23 23:18 ` lhyatt at gcc dot gnu.org
  3 siblings, 0 replies; 6+ messages in thread
From: lhyatt at gcc dot gnu.org @ 2023-10-02 20:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36887

Lewis Hyatt <lhyatt at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lhyatt at gcc dot gnu.org

--- Comment #4 from Lewis Hyatt <lhyatt at gcc dot gnu.org> ---
Patch submitted for review at
https://gcc.gnu.org/pipermail/gcc-patches/2023-September/630967.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug preprocessor/36887] Please report #pragma GCC poison" location
       [not found] <bug-36887-4@http.gcc.gnu.org/bugzilla/>
  2021-08-29 21:47 ` [Bug preprocessor/36887] Please report #pragma GCC poison" location pinskia at gcc dot gnu.org
  2023-10-02 20:05 ` lhyatt at gcc dot gnu.org
@ 2023-10-23 23:17 ` cvs-commit at gcc dot gnu.org
  2023-10-23 23:18 ` lhyatt at gcc dot gnu.org
  3 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-10-23 23:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36887

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Lewis Hyatt <lhyatt@gcc.gnu.org>:

https://gcc.gnu.org/g:cb05acdcea298b62e7fb00dcc153f5d506d085fe

commit r14-4874-gcb05acdcea298b62e7fb00dcc153f5d506d085fe
Author: Lewis Hyatt <lhyatt@gmail.com>
Date:   Thu Sep 7 17:02:47 2023 -0400

    libcpp: Improve the diagnostic for poisoned identifiers [PR36887]

    The PR requests an enhancement to the diagnostic issued for the use of a
    poisoned identifier. Currently, we show the location of the usage, but not
    the location which requested the poisoning, which would be helpful for the
    user if the decision to poison an identifier was made externally, such as
    in a library header.

    In order to output this information, we need to remember a location_t for
    each identifier that has been poisoned, and that data needs to be preserved
    as well in a PCH. One option would be to add a field to struct
cpp_hashnode,
    but there is no convenient place to add it without increasing the size of
    the struct for all identifiers. Given this facility will be needed rarely,
    it seemed better to add a second hash map, which is handled PCH-wise the
    same as the current one in gcc/stringpool.cc. This hash map associates a
new
    struct cpp_hashnode_extra with each identifier that needs one. Currently
    that struct only contains the new location_t, but it could be extended in
    the future if there is other ancillary data that may be convenient to put
    there for other purposes.

    libcpp/ChangeLog:

            PR preprocessor/36887
            * directives.cc (do_pragma_poison): Store in the extra hash map the
            location from which an identifier has been poisoned.
            * lex.cc (identifier_diagnostics_on_lex): When issuing a diagnostic
            for the use of a poisoned identifier, also add a note indicating
the
            location from which it was poisoned.
            * identifiers.cc (alloc_node): Convert to template function.
            (_cpp_init_hashtable): Handle the new extra hash map.
            (_cpp_destroy_hashtable): Likewise.
            * include/cpplib.h (struct cpp_hashnode_extra): New struct.
            (cpp_create_reader): Update prototype to...
            * init.cc (cpp_create_reader): ...accept an argument for the extra
            hash table and pass it to _cpp_init_hashtable.
            * include/symtab.h (ht_lookup): New overload for convenience.
            * internal.h (struct cpp_reader): Add EXTRA_HASH_TABLE member.
            (_cpp_init_hashtable): Adjust prototype.

    gcc/c-family/ChangeLog:

            PR preprocessor/36887
            * c-opts.cc (c_common_init_options): Pass new extra hash map
            argument to cpp_create_reader().

    gcc/ChangeLog:

            PR preprocessor/36887
            * toplev.h (ident_hash_extra): Declare...
            * stringpool.cc (ident_hash_extra): ...this new global variable.
            (init_stringpool): Handle ident_hash_extra as well as ident_hash.
            (ggc_mark_stringpool): Likewise.
            (ggc_purge_stringpool): Likewise.
            (struct string_pool_data_extra): New struct.
            (spd2): New GC root variable.
            (gt_pch_save_stringpool): Use spd2 to handle ident_hash_extra,
            analogous to how spd is used to handle ident_hash.
            (gt_pch_restore_stringpool): Likewise.

    gcc/testsuite/ChangeLog:

            PR preprocessor/36887
            * c-c++-common/cpp/diagnostic-poison.c: New test.
            * g++.dg/pch/pr36887.C: New test.
            * g++.dg/pch/pr36887.Hs: New test.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug preprocessor/36887] Please report #pragma GCC poison" location
       [not found] <bug-36887-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2023-10-23 23:17 ` cvs-commit at gcc dot gnu.org
@ 2023-10-23 23:18 ` lhyatt at gcc dot gnu.org
  3 siblings, 0 replies; 6+ messages in thread
From: lhyatt at gcc dot gnu.org @ 2023-10-23 23:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36887

Lewis Hyatt <lhyatt at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from Lewis Hyatt <lhyatt at gcc dot gnu.org> ---
Added for GCC 14.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug preprocessor/36887] Please report #pragma GCC poison" location
  2008-07-21 11:29 [Bug preprocessor/36887] New: " h dot b dot furuseth at usit dot uio dot no
  2008-07-21 11:36 ` [Bug preprocessor/36887] " h dot b dot furuseth at usit dot uio dot no
@ 2008-07-21 14:37 ` tromey at gcc dot gnu dot org
  1 sibling, 0 replies; 6+ messages in thread
From: tromey at gcc dot gnu dot org @ 2008-07-21 14:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from tromey at gcc dot gnu dot org  2008-07-21 14:36 -------
Seems like a reasonable idea to me.


-- 

tromey at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-07-21 14:36:19
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36887


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug preprocessor/36887] Please report #pragma GCC poison" location
  2008-07-21 11:29 [Bug preprocessor/36887] New: " h dot b dot furuseth at usit dot uio dot no
@ 2008-07-21 11:36 ` h dot b dot furuseth at usit dot uio dot no
  2008-07-21 14:37 ` tromey at gcc dot gnu dot org
  1 sibling, 0 replies; 6+ messages in thread
From: h dot b dot furuseth at usit dot uio dot no @ 2008-07-21 11:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from h dot b dot furuseth at usit dot uio dot no  2008-07-21 11:36 -------
Subject: Re:   New: Please report #pragma GCC poison" location

Sorry about the empty report.  Anyway:

The warning
   a.c:2:5: attempt to use poisoned "foo"
is not intelligle if one does not know about #pragma GCC poison.
(When the poisoning was done by a header file written by someone else.)

Please add an additional message
   foo.h:10: note: "foo" was poisoned here


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36887


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-10-23 23:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-36887-4@http.gcc.gnu.org/bugzilla/>
2021-08-29 21:47 ` [Bug preprocessor/36887] Please report #pragma GCC poison" location pinskia at gcc dot gnu.org
2023-10-02 20:05 ` lhyatt at gcc dot gnu.org
2023-10-23 23:17 ` cvs-commit at gcc dot gnu.org
2023-10-23 23:18 ` lhyatt at gcc dot gnu.org
2008-07-21 11:29 [Bug preprocessor/36887] New: " h dot b dot furuseth at usit dot uio dot no
2008-07-21 11:36 ` [Bug preprocessor/36887] " h dot b dot furuseth at usit dot uio dot no
2008-07-21 14:37 ` tromey at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).