Skip to content
Snippets Groups Projects
Commit 2c08ddd3 authored by Jason Merrill's avatar Jason Merrill
Browse files

libcpp: avoid extra spaces in module preprocessing

Within the compiler, module keywords "import", "module", and "export" that
are recognized as part of module directives gain an extra trailing space to
distinguish them from other non-keyword uses of those words in the code.
But when dumping preprocessed output, printing those spaces creates a
gratuitous inconsistency with non-modules preprocessing, as revealed by
several of the g++.dg/modules/cpp* tests if modules are enabled by default
in C++20 mode.

libcpp/ChangeLog:

	* lex.cc (cpp_output_token): Omit terminal space from name.

gcc/testsuite/ChangeLog:

	* g++.dg/modules/cpp-2_c.C: Expect only one space after import.
	* g++.dg/modules/cpp-5_c.C
	* g++.dg/modules/dep-2.C
	* g++.dg/modules/dir-only-2_b.C
	* g++.dg/modules/pr99050_b.C
	* g++.dg/modules/inc-xlate-1_b.H
	* g++.dg/modules/legacy-3_b.H
	* g++.dg/modules/legacy-3_c.H: Likewise.
parent dde19c60
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment