<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Oct 12, 2012, at 9:52 AM, Matthieu Monrocq <<a href="mailto:matthieu.monrocq@gmail.com">matthieu.monrocq@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><br><br><div class="gmail_quote">On Thu, Oct 11, 2012 at 11:07 PM, Douglas Gregor <span dir="ltr"><<a href="mailto:dgregor@apple.com" target="_blank">dgregor@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Author: dgregor<br>
Date: Thu Oct 11 16:07:39 2012<br>
New Revision: 165746<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=165746&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=165746&view=rev</a><br>
Log:<br>
Diagnose the expansion of ambiguous macro definitions. This can happen<br>
only with modules, when two disjoint modules #define the same<br>
identifier to different token sequences.<br>
<br></blockquote><div><br>Would it make sense to diagnose an ambiguity even if the macros both expand to the same sequence of tokens ?<br></div></div></blockquote><div><br></div>I don't think it's practical. Programmers tend to be very cavalier about defining common macros (search your system for all the definitions of NULL, for example), and we're likely to </div><div><br></div><div><blockquote type="cite"><div class="gmail_quote"><div>I am concerned with the future actually. If I am linking in two modules and they "work for now" but later on one of them change its macro definition and not the other, I'll get the warning very late.<br></div></div></blockquote><div><br></div><div>Changing a macro definition is an API change. I think it's fair to assume that kind of change will have an effect downstream, and fine for it to produce a warning if it introduces a problem.</div><br><blockquote type="cite"><div class="gmail_quote"><div>(I understand it's somewhat of a subjective opinion, but since there is a precedent with ODR for inline functions...)<br></div></div></blockquote></div><div><br></div><div>The precedent supports the behavior I've implemented. C99 6.10.3p2 allows a macro to be redefined so long as the new definition is identical to the old definition. Thus, it makes sense for macro definitions in two different modules to be permitted so long as those definitions are identical.</div><div><br></div><div>OTOH, one cannot define an inline function twice  in the same translation unit, so it should also be an error with modules.</div><br><div><span class="Apple-tab-span" style="white-space:pre">     </span>- Doug</div></body></html>