Skip to content
Snippets Groups Projects
  • Jason Merrill's avatar
    2c08ddd3
    libcpp: avoid extra spaces in module preprocessing · 2c08ddd3
    Jason Merrill authored
    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.
    2c08ddd3
    History
    libcpp: avoid extra spaces in module preprocessing
    Jason Merrill authored
    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.