jyknight wrote:

To get back to my previous point about the semantics implemented by this patch 
being unfortunate -- the upshot is that, now:
```
#include <assert.h>
#define NDEBUG
#import <assert.h>
```
will include assert.h twice (even though the latter is an "import") _only_ if 
modules are enabled. If modules are disabled, import keeps the original 
behavior of suppressing multiple inclusion. This doesn't make sense: with 
modules disabled, everything is textual -- to say that "textual header" in a 
modulemap should make a header somehow "more" textual than the default 
non-modular behavior is weird.

That is what I meant by my previous comment that this change has tied together 
features which should not be related -- and that's the main reason why I 
believe this PR should be reverted.

If we _do_ need to implement a behavior of suppressing `#import`'s include-once 
behavior for certain headers, it should be based on something within the header 
being included. E.g. could create a new`#pragma 
multiply_include_even_with_import` and add it to assert.h -- this would be 
effectively the reverse of `#pragma once`. I do not believe it's really needed 
(once the "header is hidden entirely" bug is fixed), but it would be consistent 
and not produce broken/surprising semantics.

https://github.com/llvm/llvm-project/pull/83660
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to