<br><br><div class="gmail_quote">Le 3 janvier 2012 21:13, Abramo Bagnara <span dir="ltr"><<a href="mailto:abramo.bagnara@gmail.com">abramo.bagnara@gmail.com</a>></span> a écrit :<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Author: abramo<br>
Date: Tue Jan 3 14:13:03 2012<br>
New Revision: 147473<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=147473&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=147473&view=rev</a><br>
Log:<br>
Added testcases for -Wdisabled-macro-expansion.<br>
<br>
Added:<br>
cfe/trunk/test/Preprocessor/warn-disabled-macro-expansion.c<br>
<br>
Added: cfe/trunk/test/Preprocessor/warn-disabled-macro-expansion.c<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/warn-disabled-macro-expansion.c?rev=147473&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/warn-disabled-macro-expansion.c?rev=147473&view=auto</a><br>
==============================================================================<br>
--- cfe/trunk/test/Preprocessor/warn-disabled-macro-expansion.c (added)<br>
+++ cfe/trunk/test/Preprocessor/warn-disabled-macro-expansion.c Tue Jan 3 14:13:03 2012<br>
@@ -0,0 +1,27 @@<br>
+// RUN: %clang_cc1 %s -E -Wdisabled-macro-expansion -verify<br>
+<br>
+#define p p<br>
+<br>
+#define a b<br>
+#define b a<br>
+<br>
+#define f(a) a<br>
+<br>
+#define g(b) a<br>
+<br>
+#define h(x) i(x)<br>
+#define i(y) i(y)<br>
+<br>
+#define c(x) x(0)<br>
+<br>
+p // expected-warning {{recursive macro}}<br>
+<br>
+a // expected-warning {{recursive macro}}<br>
+<br>
+f(2)<br>
+<br>
+g(3) // expected-warning {{recursive macro}}<br>
+<br>
+h(0) // expected-warning {{recursive macro}}<br>
+<br>
+c(c) // expected-warning {{recursive macro}}<br>
<br>
<br>
<br></blockquote><div>Hi Abramo,<br><br>Do you think it would be possible, sometimes, to detect those cases not at the point of expansion but at the point of definition (to avoid multiple warnings per translation unit).<br>
<br>For example:<br><br>#define p p<br><br>#define i(x) i(0)<br><br>are clearly recursive<br><br>And with<br><br>#define a b<br>#define b a<br><br>The second definition clearly introduces recursivity.<br><br>I do not know, of course, if this is easy...<br>
<br>-- Matthieu<br></div></div><br>