[Mono-bugs] [Bug 24639] New - Preprocessor behavior of #if deifferes from csc

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
13 May 2002 20:17:29 -0000


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by ipmccmono@hotmail.com.

http://bugzilla.ximian.com/show_bug.cgi?id=24639

--- shadow/24639	Mon May 13 16:17:29 2002
+++ shadow/24639.tmp.10808	Mon May 13 16:17:29 2002
@@ -0,0 +1,81 @@
+Bug#: 24639
+Product: Mono/MCS
+Version: unspecified
+OS: Red Hat 7.2
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: ipmccmono@hotmail.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Preprocessor behavior of #if deifferes from csc
+
+Description of Problem:
+
+The mcs behavior concerning #if preprocessor directives is different than 
+that of csc.  I don't know the full extent of it, but I have been able to 
+establish severl manifestations of the problem, detailed reproductionsteps 
+follow.
+
+Steps to reproduce the problem:
+1. Following source code compiles under csc, not under mcs:
+#define DEBUG
+#if (DEBUG)
+class poo {}
+#endif
+
+Produces the following output:
+
+[ian@test test]$ mcs --target library -o CSAM.Net.Finger.dll test.cs
+test.cs(3) error CS1517: Invalid pre-processor directive
+test.cs(3) error CS1517: Invalid pre-processor directive
+syntax error, expecting ABSTRACT CLASS DELEGATE ENUM EXTERN INTERFACE 
+INTERNAL NAMESPACE NEW OVERRIDE PRIVATE PROTECTED PUBLIC READONLY SEALED 
+STATIC STRUCT UNSAFE USING VIRTUAL VOLATILE OPEN_BRACKET
+test.cs (4,1), Token:257   : Parsing error 
+Mono.CSharp.yyParser.yyException
+irrecoverable syntax errorMono.CSharp.yyParser.yyExceptionin ddd 
+Mono.CSharp.CSharpParser:yyparse ()
+
+RESULT: 1
+[ian@test test]$ 
+
+2. Removing the parens around the expression allows it to compile.
+
+Similarly the following source code compiles under csc, not under mcs:
+#define DEBUG
+#define OTHER
+#if DEBUG && OTHER && true
+class poo {}
+#endif
+
+Although strangely, the followign DOES compile under mcs:
+#define DEBUG
+#if DEBUG && true
+class poo {}
+#endif
+
+Actual Results:
+
+See above.
+
+Expected Results:
+
+RESULT: 0 
+
+How often does this happen? 
+
+Reliably
+
+Additional Information:
+
+To the best of my observation, parens always cause a failure.  As for the 
+use of the true constant, thats a wierd one that's kind of hard to 
+characterize.  I don't think this behavior is affected by short circuit 
+evaluation (although that may mask the problem in some cases)