[PATCH] libcpp: Fix ICE on #include after a line marker directive [PR61474]

2023-09-15 Thread Lewis Hyatt via Gcc-patches
Hello- This fixes an old PR, bootstrap + regtest on x86-64 Linux. Please let me know if it's ok? Thanks! -Lewis -- >8 -- As noted in the PR, GCC will segfault if a file name is first seen in a linemarker directive, and then later seen in a normal #include. This is because the fake include

Re: [PATCH] preprocessor: c++: Support `#pragma GCC target' macros [PR87299]

2023-09-12 Thread Lewis Hyatt via Gcc-patches
On Tue, Aug 8, 2023 at 5:53 PM Jason Merrill wrote: > > On 7/31/23 22:22, Lewis Hyatt via Gcc-patches wrote: > > `#pragma GCC target' is not currently handled in preprocess-only mode (e.g., > > when running gcc -E or gcc -save-temps). As noted in the PR, this means that > &

Ping: [PATCH] testsuite: Add test for already-fixed issue with _Pragma expansion [PR90400]

2023-09-08 Thread Lewis Hyatt via Gcc-patches
Hello- May I please ping this one? It's adding a testcase prior to closing the PR. Thanks! https://gcc.gnu.org/pipermail/gcc-patches/2023-August/628488.html -Lewis On Fri, Aug 25, 2023 at 4:46 PM Lewis Hyatt wrote: > > Hello- > > This is adding a testcase for a PR that was already incidentally

[PATCH] testsuite: Add test for already-fixed issue with _Pragma expansion [PR90400]

2023-08-25 Thread Lewis Hyatt via Gcc-patches
Hello- This is adding a testcase for a PR that was already incidentally fixed. OK to commit please? Thanks... -Lewis -- >8 -- The PR was fixed by r12-5454. Since the fix was somewhat incidental, although related, add a testcase from PR90400 too before closing it out. gcc/testsuite/ChangeLog:

Re: [PATCH v4 3/8] diagnostics: Refactor class file_cache_slot

2023-08-23 Thread Lewis Hyatt via Gcc-patches
On Tue, Aug 15, 2023 at 03:39:40PM -0400, David Malcolm wrote: > On Tue, 2023-08-15 at 13:58 -0400, Lewis Hyatt wrote: > > On Tue, Aug 15, 2023 at 11:43:05AM -0400, David Malcolm wrote: > > > On Wed, 2023-08-09 at 18:14 -0400, Lewis Hyatt wrote: > > > > Class file_cache_slot in input.cc is used to

Re: [PATCH v4 4/8] diagnostics: Support obtaining source code lines from generated data buffers

2023-08-23 Thread Lewis Hyatt via Gcc-patches
On Tue, Aug 15, 2023 at 04:08:47PM -0400, Lewis Hyatt wrote: > On Tue, Aug 15, 2023 at 3:46 PM David Malcolm wrote: > > > > On Tue, 2023-08-15 at 14:15 -0400, Lewis Hyatt wrote: > > > On Tue, Aug 15, 2023 at 12:15:15PM -0400, David Malcolm wrote: > > > > On Wed, 2023-08-09 at 18:14 -0400, Lewis

Re: [PATCH v4 4/8] diagnostics: Support obtaining source code lines from generated data buffers

2023-08-15 Thread Lewis Hyatt via Gcc-patches
On Tue, Aug 15, 2023 at 3:46 PM David Malcolm wrote: > > On Tue, 2023-08-15 at 14:15 -0400, Lewis Hyatt wrote: > > On Tue, Aug 15, 2023 at 12:15:15PM -0400, David Malcolm wrote: > > > On Wed, 2023-08-09 at 18:14 -0400, Lewis Hyatt wrote: > > > > This patch enhances location_get_source_line(),

Re: [PATCH v4 4/8] diagnostics: Support obtaining source code lines from generated data buffers

2023-08-15 Thread Lewis Hyatt via Gcc-patches
On Tue, Aug 15, 2023 at 12:15:15PM -0400, David Malcolm wrote: > On Wed, 2023-08-09 at 18:14 -0400, Lewis Hyatt wrote: > > This patch enhances location_get_source_line(), which is the primary > > interface provided by the diagnostics infrastructure to obtain the line of > > source code

Re: [PATCH v4 3/8] diagnostics: Refactor class file_cache_slot

2023-08-15 Thread Lewis Hyatt via Gcc-patches
On Tue, Aug 15, 2023 at 11:43:05AM -0400, David Malcolm wrote: > On Wed, 2023-08-09 at 18:14 -0400, Lewis Hyatt wrote: > > Class file_cache_slot in input.cc is used to query specific lines of source > > code from a file when needed by diagnostics infrastructure. This will be > > extended in a

Re: [PATCH v4 8/8] diagnostics: Support generated data locations in SARIF output

2023-08-15 Thread Lewis Hyatt via Gcc-patches
On Tue, Aug 15, 2023 at 01:04:04PM -0400, David Malcolm wrote: > On Wed, 2023-08-09 at 18:14 -0400, Lewis Hyatt wrote: > > The diagnostics routines for SARIF output need to read the source code back > > in, so that they can generate "snippet" and "content" records, so they need > > to > > be able

Re: [PATCH v4 2/8] libcpp: diagnostics: Support generated data in expanded locations

2023-08-14 Thread Lewis Hyatt via Gcc-patches
On Fri, Aug 11, 2023 at 07:02:49PM -0400, David Malcolm wrote: > On Wed, 2023-08-09 at 18:14 -0400, Lewis Hyatt wrote: > > The previous patch in this series introduced the concept of LC_GEN line > > maps. This patch continues on the path to using them to improve _Pragma > > diagnostics, by adding

Re: [PATCH v4 1/8] libcpp: Add LC_GEN linemaps to support in-memory buffers

2023-08-13 Thread Lewis Hyatt via Gcc-patches
On Fri, Aug 11, 2023 at 06:45:31PM -0400, David Malcolm wrote: > On Wed, 2023-08-09 at 18:14 -0400, Lewis Hyatt wrote: > > Hi Lewis, thanks for the patch... > > > Add a new linemap reason LC_GEN which enables encoding the location of data > > that was generated during compilation and does not

[PATCH v4 7/8] diagnostics: libcpp: Assign real locations to the tokens inside _Pragma strings

2023-08-09 Thread Lewis Hyatt via Gcc-patches
Currently, the tokens obtained from a destringified _Pragma string do not get assigned proper locations while they are being lexed. After the tokens have been obtained, they are reassigned the same location as the _Pragma token, which is sufficient to make things like _Pragma("GCC diagnostic

[PATCH v4 6/8] diagnostics: Full support for generated data locations

2023-08-09 Thread Lewis Hyatt via Gcc-patches
Previous patches in this series have laid the groundwork for supporting source code locations in memory ("generated data") rather than ordinary files. This patch completes the support by adding awareness of such locations to all places that need to support them. The main changes are to

[PATCH v4 5/8] diagnostics: Support testing generated data in input.cc selftests

2023-08-09 Thread Lewis Hyatt via Gcc-patches
Add selftests for the new capabilities in input.cc related to source code locations that are stored in memory rather than ordinary files. gcc/ChangeLog: * input.cc (temp_source_file::do_linemap_add): New function. (line_table_case::line_table_case): Add GENERATED_DATA argument.

[PATCH v4 3/8] diagnostics: Refactor class file_cache_slot

2023-08-09 Thread Lewis Hyatt via Gcc-patches
Class file_cache_slot in input.cc is used to query specific lines of source code from a file when needed by diagnostics infrastructure. This will be extended in a subsequent patch to support obtaining the source code from in-memory generated buffers rather than from a file. The present patch

[PATCH v4 4/8] diagnostics: Support obtaining source code lines from generated data buffers

2023-08-09 Thread Lewis Hyatt via Gcc-patches
This patch enhances location_get_source_line(), which is the primary interface provided by the diagnostics infrastructure to obtain the line of source code corresponding to a given location, so that it understands generated data locations in addition to normal file-based locations. This involves

[PATCH v4 8/8] diagnostics: Support generated data locations in SARIF output

2023-08-09 Thread Lewis Hyatt via Gcc-patches
The diagnostics routines for SARIF output need to read the source code back in, so that they can generate "snippet" and "content" records, so they need to be able to cope with generated data locations. Add support for that in diagnostic-format-sarif.cc. gcc/ChangeLog: *

[PATCH v4 1/8] libcpp: Add LC_GEN linemaps to support in-memory buffers

2023-08-09 Thread Lewis Hyatt via Gcc-patches
Add a new linemap reason LC_GEN which enables encoding the location of data that was generated during compilation and does not appear in any source file. There could be many use cases, such as, for instance, referring to the content of builtin macros (not yet implemented, but an easy lift after

[PATCH v4 2/8] libcpp: diagnostics: Support generated data in expanded locations

2023-08-09 Thread Lewis Hyatt via Gcc-patches
The previous patch in this series introduced the concept of LC_GEN line maps. This patch continues on the path to using them to improve _Pragma diagnostics, by adding a new source_id SRC member to struct expanded_location, which is populated by linemap_expand_location. This member allows call

[PATCH v4 0/8] diagnostics: libcpp: Overhaul locations for _Pragma tokens

2023-08-09 Thread Lewis Hyatt via Gcc-patches
On Mon, Jul 31, 2023 at 06:39:15PM -0400, Lewis Hyatt wrote: > On Fri, Jul 28, 2023 at 6:58 PM David Malcolm wrote: > > > > On Fri, 2023-07-21 at 19:08 -0400, Lewis Hyatt wrote: > > > Add a new linemap reason LC_GEN which enables encoding the location > > > of data > > > that was generated during

Re: [PATCH] preprocessor: c++: Support `#pragma GCC target' macros [PR87299]

2023-08-09 Thread Lewis Hyatt via Gcc-patches
On Tue, Aug 1, 2023 at 11:01 AM Joseph Myers wrote: > > On Mon, 31 Jul 2023, Lewis Hyatt via Gcc-patches wrote: > > > I added some additional testcases from the PR for x86. The other targets > > that support `#pragma GCC target' (aarch64, arm, nios2, powerpc, s390) > >

[PATCH] preprocessor: c++: Support `#pragma GCC target' macros [PR87299]

2023-07-31 Thread Lewis Hyatt via Gcc-patches
`#pragma GCC target' is not currently handled in preprocess-only mode (e.g., when running gcc -E or gcc -save-temps). As noted in the PR, this means that if the target pragma defines any macros, those macros are not effective in preprocess-only mode. Similarly, such macros are not effective when

Re: [PATCH v3 1/4] diagnostics: libcpp: Add LC_GEN linemaps to support in-memory buffers

2023-07-31 Thread Lewis Hyatt via Gcc-patches
On Fri, Jul 28, 2023 at 6:58 PM David Malcolm wrote: > > On Fri, 2023-07-21 at 19:08 -0400, Lewis Hyatt wrote: > > Add a new linemap reason LC_GEN which enables encoding the location > > of data > > that was generated during compilation and does not appear in any > > source file. > > There could

Re: [PATCH v3 0/4] diagnostics: libcpp: Overhaul locations for _Pragma tokens

2023-07-29 Thread Lewis Hyatt via Gcc-patches
On Fri, Jul 28, 2023 at 6:22 PM David Malcolm wrote: > > On Fri, 2023-07-21 at 19:08 -0400, Lewis Hyatt wrote: > > Hello- > > > > This is an update to the v2 patch series last sent in January: > > https://gcc.gnu.org/pipermail/gcc-patches/2023-January/609473.html > > > > While I did not receive

Re: [PATCH v2] c-family: Implement pragma_lex () for preprocess-only mode

2023-07-28 Thread Lewis Hyatt via Gcc-patches
On Thu, Jul 27, 2023 at 06:18:33PM -0700, Jason Merrill wrote: > On 7/27/23 18:59, Lewis Hyatt wrote: > > In order to support processing #pragma in preprocess-only mode (-E or > > -save-temps for gcc/g++), we need a way to obtain the #pragma tokens from > > libcpp. In full compilation modes, this

[PATCH v2] c-family: Implement pragma_lex () for preprocess-only mode

2023-07-27 Thread Lewis Hyatt via Gcc-patches
In order to support processing #pragma in preprocess-only mode (-E or -save-temps for gcc/g++), we need a way to obtain the #pragma tokens from libcpp. In full compilation modes, this is accomplished by calling pragma_lex (), which is a symbol that must be exported by the frontend, and which is

Re: [PATCH] c-family: Implement pragma_lex () for preprocess-only mode

2023-07-26 Thread Lewis Hyatt via Gcc-patches
On Wed, Jul 26, 2023 at 5:36 PM Jason Merrill wrote: > > On 6/30/23 18:59, Lewis Hyatt wrote: > > In order to support processing #pragma in preprocess-only mode (-E or > > -save-temps for gcc/g++), we need a way to obtain the #pragma tokens from > > libcpp. In full compilation modes, this is

Re: [PATCH] c-family: Implement pragma_lex () for preprocess-only mode

2023-07-26 Thread Lewis Hyatt via Gcc-patches
May I please ping this? I am just about ready with the followup patch that fixes PR87299, but it depends on this one. Thanks! https://gcc.gnu.org/pipermail/gcc-patches/2023-June/623364.html -Lewis On Fri, Jun 30, 2023 at 6:59 PM Lewis Hyatt wrote: > > In order to support processing #pragma in

[PATCH v3 1/4] diagnostics: libcpp: Add LC_GEN linemaps to support in-memory buffers

2023-07-21 Thread Lewis Hyatt via Gcc-patches
Add a new linemap reason LC_GEN which enables encoding the location of data that was generated during compilation and does not appear in any source file. There could be many use cases, such as, for instance, referring to the content of builtin macros (not yet implemented, but an easy lift after

[PATCH v3 3/4] diagnostics: libcpp: Assign real locations to the tokens inside _Pragma strings

2023-07-21 Thread Lewis Hyatt via Gcc-patches
Currently, the tokens obtained from a destringified _Pragma string do not get assigned proper locations while they are being lexed. After the tokens have been obtained, they are reassigned the same location as the _Pragma token, which is sufficient to make things like _Pragma("GCC diagnostic

[PATCH v3 4/4] diagnostics: Support generated data locations in SARIF output

2023-07-21 Thread Lewis Hyatt via Gcc-patches
The diagnostics routines for SARIF output need to read the source code back in, so that they can generate "snippet" and "content" records, so they need to be able to cope with generated data locations. Add support for that in diagnostic-format-sarif.cc. gcc/ChangeLog: *

[PATCH v3 2/4] diagnostics: Handle generated data locations in edit_context

2023-07-21 Thread Lewis Hyatt via Gcc-patches
Class edit_context handles outputting fixit hints in diff form that could be manually or automatically applied by the user. This will not make sense for generated data locations, such as the contents of a _Pragma string, because the text to be modified does not appear in the user's input files. We

[PATCH v3 0/4] diagnostics: libcpp: Overhaul locations for _Pragma tokens

2023-07-21 Thread Lewis Hyatt via Gcc-patches
Hello- This is an update to the v2 patch series last sent in January: https://gcc.gnu.org/pipermail/gcc-patches/2023-January/609473.html While I did not receive any feedback on the v2 patches yet, they did need some rebasing on top of other recent commits to input.cc, so I thought it would be

[committed] testsuite: Fix C++ UDL tests failing on 32-bit arch [PR103902]

2023-07-19 Thread Lewis Hyatt via Gcc-patches
These tests need to use "size_t" rather than "unsigned long" for the user-defined literal function arguments. gcc/testsuite/ChangeLog: PR preprocessor/103902 * g++.dg/cpp0x/udlit-extended-id-1.C: Change "unsigned long" to "size_t" throughout. *

Ping: [PATCH v2] libcpp: Handle extended characters in user-defined literal suffix [PR103902]

2023-07-11 Thread Lewis Hyatt via Gcc-patches
May I please ping this patch again? I think it would be worthwhile to close this gap in the support for UTF-8 sources. Thanks! https://gcc.gnu.org/pipermail/gcc-patches/2023-March/613247.html -Lewis On Fri, Jun 2, 2023 at 9:45 AM Lewis Hyatt wrote: > > Hello- > > Ping please? Thanks. >

Re: 'unsigned int len' field in 'libcpp/include/symtab.h:struct ht_identifier' (was: [PATCH] pch: Fix streaming of strings with embedded null bytes)

2023-07-04 Thread Lewis Hyatt via Gcc-patches
clude/symtab.h:struct ht_identifier': > > On 2022-10-18T18:14:54-0400, Lewis Hyatt via Gcc-patches > wrote: > > When a GTY'ed struct is streamed to PCH, any plain char* pointers it > > contains > > (whether they live in GC-controlled memory or not) will be marked for

[PATCH] c-family: Implement pragma_lex () for preprocess-only mode

2023-06-30 Thread Lewis Hyatt via Gcc-patches
In order to support processing #pragma in preprocess-only mode (-E or -save-temps for gcc/g++), we need a way to obtain the #pragma tokens from libcpp. In full compilation modes, this is accomplished by calling pragma_lex (), which is a symbol that must be exported by the frontend, and which is

Re: ping: [PATCH] libcpp: Improve location for macro names [PR66290]

2023-06-19 Thread Lewis Hyatt via Gcc-patches
May I please ping this one? FWIW, it's 10 months old now without any feedback. https://gcc.gnu.org/pipermail/gcc-patches/2022-December/607647.html Most of the changes are just adapting the testsuite to look for the improved diagnostic location. Otherwise it's a handful of lines in libcpp and it

Re: [pushed] diagnostics: ensure that .sarif files are UTF-8 encoded [PR109098]

2023-06-11 Thread Lewis Hyatt via Gcc-patches
On Fri, Mar 24, 2023 at 9:04 PM David Malcolm via Gcc-patches wrote: > > PR analyzer/109098 notes that the SARIF spec mandates that .sarif > files are UTF-8 encoded, but -fdiagnostics-format=sarif-file naively > assumes that the source files are UTF-8 encoded when quoting source > artefacts in

Ping: [PATCH v2] libcpp: Handle extended characters in user-defined literal suffix [PR103902]

2023-06-02 Thread Lewis Hyatt via Gcc-patches
Hello- Ping please? Thanks. https://gcc.gnu.org/pipermail/gcc-patches/2023-March/613247.html -Lewis On Tue, May 2, 2023 at 9:27 AM Lewis Hyatt wrote: > > May I please ping this one? Thanks... > https://gcc.gnu.org/pipermail/gcc-patches/2023-March/613247.html > > On Thu, Mar 2, 2023 at 6:21 PM

Ping: [PATCH v2] libcpp: Handle extended characters in user-defined literal suffix [PR103902]

2023-05-02 Thread Lewis Hyatt via Gcc-patches
May I please ping this one? Thanks... https://gcc.gnu.org/pipermail/gcc-patches/2023-March/613247.html On Thu, Mar 2, 2023 at 6:21 PM Lewis Hyatt wrote: > > The PR complains that we do not handle UTF-8 in the suffix for a user-defined > literal, such as: > > bool operator ""_π (unsigned long

Ping: [PATCH v2] libcpp: Handle extended characters in user-defined literal suffix [PR103902]

2023-04-04 Thread Lewis Hyatt via Gcc-patches
May I please ping this one? https://gcc.gnu.org/pipermail/gcc-patches/2023-March/613247.html Thanks! -Lewis On Thu, Mar 2, 2023 at 6:21 PM Lewis Hyatt wrote: > > The PR complains that we do not handle UTF-8 in the suffix for a user-defined > literal, such as: > > bool operator ""_π (unsigned

Re: [PATCH] libcpp: Update to Unicode 15

2023-03-09 Thread Lewis Hyatt via Gcc-patches
On Fri, Nov 04, 2022 at 10:03:13AM +0100, Jakub Jelinek via Gcc-patches wrote: > Hi! > > The following pseudo-patch (for uname2c.h part > just a pseudo patch with a lot of changes replaced with ... > because it is too large but the important changes like > -static const char uname2c_dict[59418] =

Ping: [PATCH] libcpp: Fix ICE on directive inside _Pragma() operator [PR67046]

2023-03-07 Thread Lewis Hyatt via Gcc-patches
Hello- May I please ping this short patch that fixes an old bug? Thanks... -Lewis On Sat, Jan 14, 2023 at 1:46 PM Lewis Hyatt wrote: > > get__Pragma_string() in directives.cc is responsible for lexing the parens > and the string argument from a _Pragma("...") operator. This function does > not

[PATCH v2] libcpp: Handle extended characters in user-defined literal suffix [PR103902]

2023-03-02 Thread Lewis Hyatt via Gcc-patches
The PR complains that we do not handle UTF-8 in the suffix for a user-defined literal, such as: bool operator ""_π (unsigned long long); In fact we don't handle any extended identifier characters there, whether UTF-8, UCNs, or the $ sign. We do handle it fine if the optional space after the ""

Re: Ping^3: [PATCH] libcpp: Handle extended characters in user-defined literal suffix [PR103902]

2023-02-15 Thread Lewis Hyatt via Gcc-patches
On Wed, Feb 15, 2023 at 1:39 PM Jason Merrill wrote: > > On 9/26/22 15:27, Lewis Hyatt wrote: > > On Wed, Jun 15, 2022 at 03:06:16PM -0400, Lewis Hyatt wrote: > >> On Tue, Jun 14, 2022 at 05:26:49PM -0400, Lewis Hyatt wrote: > >>> Hello- > >>> > >>>

Re: Ping^3: [PATCH] libcpp: Handle extended characters in user-defined literal suffix [PR103902]

2023-02-10 Thread Lewis Hyatt via Gcc-patches
On Fri, Feb 10, 2023 at 11:30 AM Jakub Jelinek wrote: > > On Mon, Sep 26, 2022 at 06:27:25PM -0400, Lewis Hyatt via Gcc-patches wrote: > > May I please ping this patch again? Joseph suggested that it would be best > > if > > a C++ maintainer has a look at it. This is

[PATCH] libcpp: Fix ICE on directive inside _Pragma() operator [PR67046]

2023-01-14 Thread Lewis Hyatt via Gcc-patches
get__Pragma_string() in directives.cc is responsible for lexing the parens and the string argument from a _Pragma("...") operator. This function does not handle the case when the closing paren is not on the same line as the string; in that case, libcpp will by default reuse the token buffer it

ping: [PATCH] libcpp: Improve location for macro names [PR66290]

2023-01-12 Thread Lewis Hyatt via Gcc-patches
https://gcc.gnu.org/pipermail/gcc-patches/2022-December/607647.html May I please ping this one again? It will enable closing out the PR. Thanks! -Lewis On Thu, Dec 1, 2022 at 9:22 AM Lewis Hyatt wrote: > > Hello- > > https://gcc.gnu.org/pipermail/gcc-patches/2022-August/599397.html > > May I

[PATCH v2 3/4] diagnostics: libcpp: Assign real locations to the tokens inside _Pragma strings

2023-01-05 Thread Lewis Hyatt via Gcc-patches
Currently, the tokens obtained from a destringified _Pragma string do not get assigned proper locations while they are being lexed. After the tokens have been obtained, they are reassigned the same location as the _Pragma token, which is sufficient to make things like _Pragma("GCC diagnostic

[PATCH v2 1/4] diagnostics: libcpp: Add LC_GEN linemaps to support in-memory buffers

2023-01-05 Thread Lewis Hyatt via Gcc-patches
Add a new linemap reason LC_GEN which enables encoding the location of data that was generated during compilation and does not appear in any source file. There could be many use cases, such as, for instance, referring to the content of builtin macros (not yet implemented, but an easy lift after

[PATCH v2 4/4] diagnostics: Support generated data locations in SARIF output

2023-01-05 Thread Lewis Hyatt via Gcc-patches
The diagnostics routines for SARIF output need to read the source code back in, so that they can generate "snippet" and "content" records, so they need to be able to cope with generated data locations. Add support for that in diagnostic-format-sarif.cc. gcc/ChangeLog: *

[PATCH v2 2/4] diagnostics: Handle generated data locations in edit_context

2023-01-05 Thread Lewis Hyatt via Gcc-patches
Class edit_context handles outputting fixit hints in diff form that could be manually or automatically applied by the user. This will not make sense for generated data locations, such as the contents of a _Pragma string, because the text to be modified does not appear in the user's input files. We

[PATCH v2 0/4] diagnostics: libcpp: Overhaul locations for _Pragma tokens

2023-01-05 Thread Lewis Hyatt via Gcc-patches
Hello- This series contains the four remaining patches in the series originally sent here: https://gcc.gnu.org/pipermail/gcc-patches/2022-November/605029.html which implements improved locations for tokens lexed from a string inside a _Pragma directive. v2 1/4: diagnostics: libcpp: Add LC_GEN

Re: [PATCH 4/6] diagnostics: libcpp: Add LC_GEN linemaps to support in-memory buffers

2023-01-05 Thread Lewis Hyatt via Gcc-patches
On Thu, Nov 17, 2022 at 4:21 PM Lewis Hyatt wrote: > > On Sat, Nov 05, 2022 at 12:23:28PM -0400, David Malcolm wrote: > > On Fri, 2022-11-04 at 09:44 -0400, Lewis Hyatt via Gcc-patches wrote: > > [...snip...] > > > > > > diff --git a/gcc/c-family/c-common.cc b/

[PATCH] preprocessor: Don't register pragmas in directives-only mode [PR108244]

2022-12-30 Thread Lewis Hyatt via Gcc-patches
libcpp's directives-only mode does not expect deferred pragmas to be registered, but to date the c-family registration process has not checked for this case. That issue became more visible since r13-1544, which added the commonly used GCC diagnostic pragmas to the set of those registered in

Ping^3: [PATCH] libcpp: Improve location for macro names [PR66290]

2022-12-01 Thread Lewis Hyatt via Gcc-patches
Hello- https://gcc.gnu.org/pipermail/gcc-patches/2022-August/599397.html May I please ping this one? Thanks! I have also re-attached the rebased patch here. -Lewis On Wed, Oct 12, 2022 at 06:37:50PM -0400, Lewis Hyatt wrote: > Hello- > >

Re: [PATCH 4/6] diagnostics: libcpp: Add LC_GEN linemaps to support in-memory buffers

2022-11-17 Thread Lewis Hyatt via Gcc-patches
On Sat, Nov 05, 2022 at 12:23:28PM -0400, David Malcolm wrote: > On Fri, 2022-11-04 at 09:44 -0400, Lewis Hyatt via Gcc-patches wrote: > [...snip...] > > > > diff --git a/gcc/c-family/c-common.cc b/gcc/c-family/c-common.cc > > index 5890c18bdc3..2935d7fb236 100644

Re: [PATCH 4/6] diagnostics: libcpp: Add LC_GEN linemaps to support in-memory buffers

2022-11-05 Thread Lewis Hyatt via Gcc-patches
Thanks for the comments! I have some replies below. On Sat, Nov 5, 2022 at 12:23 PM David Malcolm wrote: > [...snip...] > > > > diff --git a/gcc/c-family/c-common.cc b/gcc/c-family/c-common.cc > > index 5890c18bdc3..2935d7fb236 100644 > > --- a/gcc/c-family/c-common.cc > > +++

Re: [PATCH 5/6] diagnostics: Support generated data in additional contexts

2022-11-04 Thread Lewis Hyatt via Gcc-patches
On Fri, Nov 04, 2022 at 12:42:29PM -0400, David Malcolm wrote: > On Fri, 2022-11-04 at 09:44 -0400, Lewis Hyatt via Gcc-patches wrote: > > Add awareness that diagnostic locations may be in generated buffers > > rather > > than an actual file to other places in the diag

[PATCH 6/6] diagnostics: libcpp: Assign real locations to the tokens inside _Pragma strings

2022-11-04 Thread Lewis Hyatt via Gcc-patches
Currently, the tokens obtained from a destringified _Pragma string do not get assigned proper locations while they are being lexed. After the tokens have been obtained, they are reassigned the same location as the _Pragma token, which is sufficient to make things like _Pragma("GCC diagnostic

[PATCH 5/6] diagnostics: Support generated data in additional contexts

2022-11-04 Thread Lewis Hyatt via Gcc-patches
Add awareness that diagnostic locations may be in generated buffers rather than an actual file to other places in the diagnostics code that may care, most notably SARIF output (which needs to obtain its own snapshots of the code involved). For edit context output, which outputs fixit hints as

[PATCH 4/6] diagnostics: libcpp: Add LC_GEN linemaps to support in-memory buffers

2022-11-04 Thread Lewis Hyatt via Gcc-patches
Add a new linemap reason LC_GEN which enables encoding the location of data that was generated during compilation and does not appear in any source file. There could be many use cases, such as, for instance, referring to the content of builtin macros (not yet implemented, but an easy lift after

[PATCH 2/6] diagnostics: Use an inline function rather than hardcoding string

2022-11-04 Thread Lewis Hyatt via Gcc-patches
The string "" is hard-coded in several places throughout the diagnostics code, and in some of those places, it is used incorrectly with respect to internationalization. (Comparing a translated string to an untranslated string.) The error is not currently observable in any output GCC actually

[PATCH 3/6] libcpp: Fix paste error with unknown pragma after macro expansion

2022-11-04 Thread Lewis Hyatt via Gcc-patches
In directives.cc, do_pragma() contains logic to handle a case such as the new testcase pragma-omp-unknown.c, where an unknown pragma was the result of macro expansion (for pragma namespaces that permit expansion). This no longer works correctly as shown by the testcase, fixed by adding PREV_WHITE

[PATCH 1/6] diagnostics: Fix macro tracking for ad-hoc locations

2022-11-04 Thread Lewis Hyatt via Gcc-patches
The result of linemap_resolve_location() can be an ad-hoc location, if that is what was stored in a relevant macro map. maybe_unwind_expanded_macro_loc() did not previously handle this case, causing it to print the wrong tracking information for an example such as the new testcase

[PATCH 0/6] diagnostics: libcpp: Overhaul locations for _Pragma tokens

2022-11-04 Thread Lewis Hyatt via Gcc-patches
Hello- In the past couple years there has been a ton of progress in fixing bugs related to _Pragma, especially its use in the type of macros that many projects like to implement for manipulating GCC diagnostic pragmas more easily. For GCC 13 I have been going through the remaining open PRs,

Re: [PATCH] diagnostics: Allow FEs to keep customizations for middle end [PR101551, PR106274]

2022-11-03 Thread Lewis Hyatt via Gcc-patches
On Fri, Oct 28, 2022 at 10:28:21AM +0200, Richard Biener wrote: > Yes, the idea was also to free up memory but then that part never > really materialized - the idea was to always run free-lang-data, not > just when later outputting LTO bytecode. The reason is probably > mainly the diagnostic

[PATCH] c++: libcpp: Support raw strings with newlines in directives [PR55971]

2022-10-27 Thread Lewis Hyatt via Gcc-patches
Hello- May I please ask for a review of this patch from June? I realize it's a 10-year-old PR that doesn't seem to be bothering people much, but I still feel like it's an unfortunate gap in C++11 support that is not hard to fix. Original submission is here:

Re: [PATCH] diagnostics: Allow FEs to keep customizations for middle end [PR101551, PR106274]

2022-10-25 Thread Lewis Hyatt via Gcc-patches
On Tue, Oct 25, 2022 at 7:35 AM Richard Biener wrote: > > On Thu, Oct 20, 2022 at 1:09 AM Lewis Hyatt via Gcc-patches > wrote: > > > > Currently, the ipa-free-lang-data pass resets most of the frontend's > > diagnostic customizations, such as the diagnostic_final

[PATCH] diagnostics: Allow FEs to keep customizations for middle end [PR101551, PR106274]

2022-10-19 Thread Lewis Hyatt via Gcc-patches
Currently, the ipa-free-lang-data pass resets most of the frontend's diagnostic customizations, such as the diagnostic_finalizer that prints macro expansion information, which is the subject of the two PRs. In most cases, however, there is no need to reset these customizations; they still work

Re: [PATCH] pch: Fix streaming of strings with embedded null bytes

2022-10-19 Thread Lewis Hyatt via Gcc-patches
On Wed, Oct 19, 2022 at 8:23 AM Jakub Jelinek wrote: > > On Wed, Oct 19, 2022 at 01:17:02PM +0100, Richard Sandiford wrote: > > Jakub Jelinek writes: > > > On Wed, Oct 19, 2022 at 12:54:11PM +0100, Richard Sandiford via > > > Gcc-patches wrote: > > &g

[PATCH] pch: Fix streaming of strings with embedded null bytes

2022-10-18 Thread Lewis Hyatt via Gcc-patches
When a GTY'ed struct is streamed to PCH, any plain char* pointers it contains (whether they live in GC-controlled memory or not) will be marked for PCH output by the routine gt_pch_note_object in ggc-common.cc. This routine special-cases plain char* strings, and in particular it uses strlen() to

Ping^2: [PATCH] libcpp: Improve location for macro names [PR66290]

2022-10-12 Thread Lewis Hyatt via Gcc-patches
Hello- https://gcc.gnu.org/pipermail/gcc-patches/2022-August/599397.html Since Jeff was kind enough to ack one of my other preprocessor patches today, I have become emboldened to ping this one again too :). Would anyone have some time to take a look at it please? Thanks! -Lewis On Thu, Sep 15,

[PATCH] preprocessor: Fix tracking of system header state [PR60014, PR60723]

2022-10-08 Thread Lewis Hyatt via Gcc-patches
The token_streamer class (which implements gcc mode -E and -save-temps/-no-integrated-cpp) needs to keep track whether the last tokens output were in a system header, so that it can generate line marker annotations as necessary for a downstream consumer to reconstruct the state. The logic for

[PATCH] diagnostics: Add test for fixed _Pragma location issue [PR91669]

2022-10-03 Thread Lewis Hyatt via Gcc-patches
This PR related to _Pragma locations and diagnostic pragmas was fixed by a combination of r10-325 and r13-1596. Add missing test coverage. gcc/testsuite/ChangeLog: PR c/91669 * c-c++-common/pr91669.c: New test. --- Notes: Hello-

[PATCH] diagnostics: Fix virtual location for -Wuninitialized [PR69543]

2022-09-29 Thread Lewis Hyatt via Gcc-patches
Warnings issued for -Wuninitialized have been using the spelling location of the problematic usage, discarding any information on the location of the macro expansion point if such usage was in a macro. This makes the warnings impossible to control reliably with #pragma GCC diagnostic, and also

Ping^3: [PATCH] libcpp: Handle extended characters in user-defined literal suffix [PR103902]

2022-09-26 Thread Lewis Hyatt via Gcc-patches
On Wed, Jun 15, 2022 at 03:06:16PM -0400, Lewis Hyatt wrote: > On Tue, Jun 14, 2022 at 05:26:49PM -0400, Lewis Hyatt wrote: > > Hello- > > > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103902 > > > > The attached patch resolves PR preprocessor/103902 as described in the patch > > message

Ping: [PATCH] libcpp: Improve location for macro names [PR66290]

2022-09-15 Thread Lewis Hyatt via Gcc-patches
Hello- https://gcc.gnu.org/pipermail/gcc-patches/2022-August/599397.html May I please ping this patch? Thank you. -Lewis On Fri, Aug 5, 2022 at 12:14 PM Lewis Hyatt wrote: > > > When libcpp reports diagnostics whose locus is a macro name (such as for > -Wunused-macros), it uses the location in

[PATCH] pch: Fix the reconstruction of adhoc data hash table

2022-09-07 Thread Lewis Hyatt via Gcc-patches
The function rebuild_location_adhoc_htab() was meant to reconstruct the adhoc location hash map after restoring a line_maps instance from a PCH. However, the function has never performed as intended because it missed the last step of adding the data into the newly reconstructed hash map. This

Re: Ping^2: 2 libcpp patches

2022-08-23 Thread Lewis Hyatt via Gcc-patches
On Tue, Aug 16, 2022 at 9:50 AM Lewis Hyatt wrote: > > On Wed, Jul 20, 2022 at 8:56 PM Lewis Hyatt wrote: > > > > Hello- > > > > May I please ping these two preprocessor patches? > > > > For PR103902: > > https://gcc.gnu.org/pipermail/gcc-patches/2022-June/596704.html > > > > For PR55971: > >

Ping^2: 2 libcpp patches

2022-08-16 Thread Lewis Hyatt via Gcc-patches
On Wed, Jul 20, 2022 at 8:56 PM Lewis Hyatt wrote: > > Hello- > > May I please ping these two preprocessor patches? > > For PR103902: > https://gcc.gnu.org/pipermail/gcc-patches/2022-June/596704.html > > For PR55971: > https://gcc.gnu.org/pipermail/gcc-patches/2022-June/596820.html > > Thanks!

[PATCH] libcpp: Improve location for macro names [PR66290]

2022-08-05 Thread Lewis Hyatt via Gcc-patches
When libcpp reports diagnostics whose locus is a macro name (such as for -Wunused-macros), it uses the location in the cpp_macro object that was stored by _cpp_new_macro. This is currently set to pfile->directive_line, which contains the line number only and no column information. This patch

Re: [COMMITTED,gcc12] c: Fix location for _Pragma tokens [PR97498]

2022-08-02 Thread Lewis Hyatt via Gcc-patches
On Mon, Aug 01, 2022 at 07:15:48PM -0400, Lewis Hyatt wrote: > Hello- > > This backport from r13-1596 to GCC 12 has been committed after > pre-approval. This was a straightforward cherry-pick from master with no > adjustments needed. I would like to note that subsequent to r13-1596, Thomas >

[COMMITTED,gcc12] c: Fix location for _Pragma tokens [PR97498]

2022-08-01 Thread Lewis Hyatt via Gcc-patches
Hello- This backport from r13-1596 to GCC 12 has been committed after pre-approval. This was a straightforward cherry-pick from master with no adjustments needed. I would like to note that subsequent to r13-1596, Thomas made a few commits to the libgomp testsuite to test for new diagnostic

Re: [PATCH 1/1] c++/106423: Fix pragma suppression of -Wc++20-compat diagnostics.

2022-07-31 Thread Lewis Hyatt via Gcc-patches
On Sat, Jul 30, 2022 at 7:06 PM Tom Honermann via Gcc-patches wrote: > > On 7/27/22 7:09 PM, Joseph Myers wrote: > > On Sun, 24 Jul 2022, Tom Honermann via Gcc-patches wrote: > > > >> Gcc's '#pragma GCC diagnostic' directives are processed in "early mode" > >> (see handle_pragma_diagnostic_early)

Re: [PATCH] c: Fix location for _Pragma tokens [PR97498]

2022-07-31 Thread Lewis Hyatt via Gcc-patches
On Sat, Jul 30, 2022 at 10:43 PM Jeff Law wrote: > > There was a request to backport this > > (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97498#c7) since it is > > relevant to this one: > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106267. Is that OK as > > well for any of the current

[PATCH] c++: Fix location for -Wunused-macros [PR66290]

2022-07-28 Thread Lewis Hyatt via Gcc-patches
In C++, since all tokens are lexed from libcpp up front, diagnostics generated by libcpp after lexing has completed do not get a valid location from libcpp (rather, libcpp thinks they all pertain to the end of the file.) This has long been addressed using the global variable "done_lexing", which

Ping: 2 libcpp patches

2022-07-20 Thread Lewis Hyatt via Gcc-patches
Hello- May I please ping these two preprocessor patches? For PR103902: https://gcc.gnu.org/pipermail/gcc-patches/2022-June/596704.html For PR55971: https://gcc.gnu.org/pipermail/gcc-patches/2022-June/596820.html Thanks! -Lewis

Re: [PATCH] libphobos: Fix instability in the parallelized testsuite

2022-07-17 Thread Lewis Hyatt via Gcc-patches
> Hi Lewis, > > Thanks! Good spot. I think it should be calling dg-runtest however, > same as what libphobos.cycles/cycles.exp is doing. Could also fix the > test name so each one is unique, just to hit two birds in one - > something like the following would suffice (haven't had time to check). >

Re: [PATCH] c: Fix location for _Pragma tokens [PR97498]

2022-07-17 Thread Lewis Hyatt via Gcc-patches
On Sat, Jul 9, 2022 at 11:59 PM Jeff Law via Gcc-patches wrote: > > > > On 7/9/2022 2:52 PM, Lewis Hyatt via Gcc-patches wrote: > > Hello- > > > > PR97498 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97498) is another PR > > related to the fact that im

[PATCH] libphobos: Fix instability in the parallelized testsuite

2022-07-14 Thread Lewis Hyatt via Gcc-patches
Hello- I get a different number of test results from libphobos.unittest/unittest.exp, depending on server load. I believe it's because this testsuite doesn't check runtest_file_p: $ make -j 1 RUNTESTFLAGS='unittest.exp' check-target-libphobos | grep '^#' # of expected passes 10 $

Re: XFAIL 'offloading_enabled' diagnostics issue in 'libgomp.oacc-c-c++-common/reduction-5.c' [PR101551] (was: Enhance '_Pragma' diagnostics verification in OMP C/C++ test cases)

2022-07-13 Thread Lewis Hyatt via Gcc-patches
On Tue, Jul 12, 2022 at 9:10 AM Tobias Burnus wrote: > On 12.07.22 13:50, Lewis Hyatt via Gcc-patches wrote: > > On Tue, Jul 12, 2022 at 2:33 AM Thomas Schwinge > > wrote: > >> On 2022-07-11T11:27:12+0200, I wrote: > >>> Oh my, PR101551 "[o

Re: XFAIL 'offloading_enabled' diagnostics issue in 'libgomp.oacc-c-c++-common/reduction-5.c' [PR101551] (was: Enhance '_Pragma' diagnostics verification in OMP C/C++ test cases)

2022-07-12 Thread Lewis Hyatt via Gcc-patches
On Tue, Jul 12, 2022 at 2:33 AM Thomas Schwinge wrote: > > Hi! > > On 2022-07-11T11:27:12+0200, I wrote: > > [...], I've just pushed to master branch > > commit 06b2a2abe26554c6f9365676683d67368cbba206 > > "Enhance '_Pragma' diagnostics verification in OMP C/C++ test cases" > > > ---

[PATCH] preprocessor: Set input_location to the most recently seen token

2022-07-11 Thread Lewis Hyatt via Gcc-patches
Hello- As discussed here: https://gcc.gnu.org/pipermail/gcc-patches/2022-July/598136.html Here is another short patch that improves "#pragma GCC diagnostic" handling. Longer term, it will be desirable to make the handling of this pragma independent of the global input_location. But in the

[COMMITTED] c-family: Fix option check in handle_pragma_diagnostic [PR106252]

2022-07-11 Thread Lewis Hyatt via Gcc-patches
Hello- PR106252 notes an error found by the address sanitizer from r13-1544. This was my mistake during refactoring of handle_pragma_diagnostic(), the check for the option arg was moved earlier than it should be. Committed the obvious fix putting this back where it was before. -Lewis c-family:

Re: [PATCH] c: Fix location for _Pragma tokens [PR97498]

2022-07-10 Thread Lewis Hyatt via Gcc-patches
On Sat, Jul 9, 2022 at 11:59 PM Jeff Law via Gcc-patches wrote: > > > > On 7/9/2022 2:52 PM, Lewis Hyatt via Gcc-patches wrote: > > Hello- > > > > PR97498 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97498) is another PR > > related to the fact that im

[PATCH] c: Fix location for _Pragma tokens [PR97498]

2022-07-09 Thread Lewis Hyatt via Gcc-patches
Hello- PR97498 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97498) is another PR related to the fact that imprecise locations for _Pragma result in counterintuitive behavior for GCC diagnostic pragmas, which inhibit the ability to make convenient wrapper macros for enabling and disabling

[PATCH] diagnostics: Make line-ending logic consistent with libcpp [PR91733]

2022-07-07 Thread Lewis Hyatt via Gcc-patches
Hello- The PR (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91733) points out that, while libcpp recognizes a lone '\r' as a valid line-ending character, the infrastructure that obtains source lines to be printed in diagnostics does not, and hence diagnostics do not output the intended portion of

  1   2   >