Skip to content
Browse files

Add flag to disable warnings about lack of Flags attribute. Make use …

…of not flaged enums in DomCodeGenerator.

git-svn-id: https://nemerle.googlecode.com/svn/nemerle/trunk@3201 c8a6711f-211a-0410-a8d5-2f220496d6d1
  • Loading branch information...
1 parent 0631974 commit fcc1a750d66d2186902c26e159455393bed9a1b9 nazgul committed Sep 15, 2004
View
BIN boot/Nemerle.Compiler.dll
Binary file not shown.
View
BIN boot/Nemerle.Macros.dll
Binary file not shown.
View
BIN boot/Nemerle.dll
Binary file not shown.
View
BIN boot/ncc.exe
Binary file not shown.
View
4 macros/operators.n
@@ -387,7 +387,7 @@ module Operators {
| _ => Util.ice ("lookup_unary_enum_operator")
}
- when (!has_flags_attribute (tc))
+ when (!has_flags_attribute (tc) && Flags.enum_flags_warnings)
Message.warning ($ "bit-wise negation is only allowed over enum types "
"with the System.FlagsAttribute set, "
"the enum type $tc is not marked with the System.FlagsAttribute");
@@ -499,7 +499,7 @@ module Operators {
| _ => Util.ice ()
}
- when (!has_flags_attribute (tc))
+ when (!has_flags_attribute (tc) && Flags.enum_flags_warnings)
Message.warning ($ "bit operations are only allowed over enum types "
"with the System.FlagsAttribute set, "
"the enum type $tc (on sides of a bit `$(name)' "
View
3 ncc/Makefile
@@ -34,8 +34,7 @@ include ../config.mak
############################################################
COMPILER_PATH = ../boot/
-# -global-unused-symbols-warnings
-NCC_FLAGS = -pedantic-lexer -global-unused-symbols-warnings $(NEM_FLAGS)
+NCC_FLAGS = -pedantic-lexer -global-unused-symbols-warnings -no-enum-flags-warnings $(NEM_FLAGS)
COMPILER = $(COMPILER_PATH)ncc.exe
COMPILER_DEP = $(COMPILER_PATH)ncc.exe $(COMPILER_PATH)Nemerle.Macros.dll
EXECUTE = $(NET_ENGINE) $(NET_FLAGS)
View
38 ncc/codedom/NemerleCodeGenerator.n
@@ -509,7 +509,7 @@ namespace Nemerle.Compiler
OutputAttributeDeclarations(eventRef.CustomAttributes);
OutputMemberAccessModifier (eventRef.Attributes);
- OutputMemberScopeModifier (eventRef.Attributes /*%| MemberAttributes.Final*/); // Don't output "virtual"
+ OutputMemberScopeModifier (eventRef.Attributes %| MemberAttributes.Final); // Don't output "virtual"
Output.Write ("event ");
OutputTypeNamePair (eventRef.Type, GetSafeName (eventRef.Name));
Output.WriteLine (';');
@@ -548,16 +548,13 @@ namespace Nemerle.Compiler
protected override OutputFieldScopeModifier (attributes : MemberAttributes) : void
{
- def attributes = attributes :> int;
- when (attributes %& (MemberAttributes.VTableMask :> int) ==
- (MemberAttributes.New :> int))
+ when (attributes %& MemberAttributes.VTableMask == MemberAttributes.New)
Output.Write("new ");
- when ((attributes %&& (MemberAttributes.Static :> int)) ||
- (attributes %&& (MemberAttributes.Const :> int)))
+ when ((attributes %&& MemberAttributes.Static) ||
+ (attributes %&& MemberAttributes.Const))
Output.Write("static ");
-// when (! (attributes %&& (MemberAttributes.Const :> int)))
+// when (! (attributes %&& MemberAttributes.Const))
Output.Write("mutable ");
-// Nemerle.IO.print (attributes.ToString () + "\n");
}
protected override GenerateSnippetMember (member : CodeSnippetTypeMember) : void
@@ -609,7 +606,8 @@ namespace Nemerle.Compiler
output.Write (" : ");
OutputType (method.ReturnType);
- if ( ((attributes :> int) %& (MemberAttributes.ScopeMask :> int)) == (MemberAttributes.Abstract :> int) || declaration.IsInterface)
+ if ( (attributes %& MemberAttributes.ScopeMask) == MemberAttributes.Abstract
+ || declaration.IsInterface)
output.WriteLine ( ';' );
else {
when (privateType != null)
@@ -896,21 +894,17 @@ namespace Nemerle.Compiler
Output.Write (")");
}
- protected override OutputOperator (op : CodeBinaryOperatorType) : void
- {
-/* buggy warning
- match (op) {
- | CodeBinaryOperatorType.BitwiseAnd =>
- Output.Write(" %& ");
+ protected override OutputOperator (op : CodeBinaryOperatorType) : void
+ {
+ | CodeBinaryOperatorType.BitwiseAnd =>
+ Output.Write(" %& ");
- | CodeBinaryOperatorType.BitwiseOr =>
- Output.Write(" %| ");
+ | CodeBinaryOperatorType.BitwiseOr =>
+ Output.Write(" %| ");
- | _ =>
- */
- base.OutputOperator(op);
-// }
- }
+ | _ =>
+ base.OutputOperator(op);
+ }
/*
* ICodeGenerator
View
3 ncc/codedom/NemerleCodeProvider.n
@@ -1,8 +1,9 @@
//
-// NemerleCodeProvider.cs
+// NemerleCodeProvider.n
//
// Author:
// Atsushi Enomoto <atsushi@ximian.com>
+// Kamil Skalski <nazgul@nemerle.org>
//
// Too short to be copyrighted.
//
View
3 ncc/constantfolder.n
@@ -57,7 +57,8 @@ namespace Nemerle.Compiler
emit_flag_warning (t : Tycon) : void
{
when ((t.GetTydecl () matches TT.TD_enum) &&
- ! t.HasAttribute (InternalType.FlagsAttribute_tc))
+ ! t.HasAttribute (InternalType.FlagsAttribute_tc) &&
+ Flags.enum_flags_warnings)
Message.warning ($ "using bitwise operator on enum type `$(t)' "
"that has [Flags] attribute");
}
View
2 ncc/flags.n
@@ -45,6 +45,7 @@ namespace Nemerle.Compiler
public mutable color_messages : bool;
public mutable use_loaded_corlib : bool;
public mutable global_unused_symbols_warnings : bool;
+ public mutable enum_flags_warnings : bool;
this ()
{
@@ -59,6 +60,7 @@ namespace Nemerle.Compiler
color_messages = true;
dump_typed_tree = false;
global_unused_symbols_warnings = false;
+ enum_flags_warnings = true;
}
}
}
View
4 ncc/main.n
@@ -264,6 +264,10 @@ namespace Nemerle.Compiler
Getopt.Flag (name = "-global-unused-symbols-warnings",
help = "Print the warnings about globally unused symbols",
handler = fun () { Flags.global_unused_symbols_warnings = true }),
+ Getopt.Flag (name = "-no-enum-flags-warnings",
+ help = "Do not print warnings about usage of bit operations"
+ " on enums without correct attribute",
+ handler = fun () { Flags.enum_flags_warnings = false }),
Getopt.Flag (name = "-no-progress-bar",
aliases = ["-q"],
help = "Disable progress bar",

0 comments on commit fcc1a75

Please sign in to comment.
Something went wrong with that request. Please try again.