Submitter:Fred Tydeman
Submission Date: 2018-12-12
Document: WG14 N2324
Reference Documents: N1942

Summary

SD3 item 13 (DR 482) against C2X: Macro invocation span files.

It was decided that DR 482 would be fixed in C2X as undefined behaviour.

Possible Technical Corrigendum:

  1. Add to §5.1.1.2 (Translation phases), paragraph 1, bullet 3, words along the lines of:

    A macro invocation shall be contained within one source file.
  2. Add after §6.10.3 (Macro replacement), paragraph 6 (constraints), a new paragraph:

    A macro invocation shall be contained within one source file.
  3. Add after §6.10.3 (Macro replacement), paragraph 12 (semantics), a new paragraph:

    A macro invocation that spans two or more files is undefined behavior.

Add to J.2 Undefined behavior

A macro invocation that spans two or more files is undefined behavior.

Existing practice

Some implementations accept (as required by all previous versions of the C standard) a macro invocation that is split between two or more files. Other implementations, consider it a translation error and will not compile such code. Making this undefined allows both sets of implementations to conform. This is a silent change.