From 3c2c4168e0d75dbe23239f182b14f627133d9a9c Mon Sep 17 00:00:00 2001 From: Marek Safar Date: Wed, 1 Jun 2016 09:36:21 +0200 Subject: [PATCH] [mcs] Adjust correctly newline counter inside pragma warning --- mcs/mcs/cs-tokenizer.cs | 4 +++- mcs/tests/test-debug-30-ref.xml | 31 +++++++++++++++++++++++++++++++ mcs/tests/test-debug-30.cs | 18 ++++++++++++++++++ mcs/tests/ver-il-net_4_x.xml | 13 +++++++++++++ 4 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 mcs/tests/test-debug-30-ref.xml create mode 100644 mcs/tests/test-debug-30.cs diff --git a/mcs/mcs/cs-tokenizer.cs b/mcs/mcs/cs-tokenizer.cs index 99759aac984..cd7ce1ac68f 100644 --- a/mcs/mcs/cs-tokenizer.cs +++ b/mcs/mcs/cs-tokenizer.cs @@ -2523,7 +2523,6 @@ namespace Mono.CSharp int TokenizePragmaWarningIdentifier (ref int c, ref bool identifier) { - if ((c >= '0' && c <= '9') || is_identifier_start_character (c)) { int number; @@ -2588,6 +2587,9 @@ namespace Mono.CSharp while (c == ' ' || c == '\t') c = get_char (); + if (c == '\n' || c == UnicodeLS || c == UnicodePS) + advance_line (); + return number; } diff --git a/mcs/tests/test-debug-30-ref.xml b/mcs/tests/test-debug-30-ref.xml new file mode 100644 index 00000000000..461f6573e59 --- /dev/null +++ b/mcs/tests/test-debug-30-ref.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mcs/tests/test-debug-30.cs b/mcs/tests/test-debug-30.cs new file mode 100644 index 00000000000..78f0cdfe3c7 --- /dev/null +++ b/mcs/tests/test-debug-30.cs @@ -0,0 +1,18 @@ +class PragmaNewLinesParsing +{ +#pragma warning disable RECS0029 +#pragma warning restore RECS0029 + + void Foo () + { + return; + } + +#pragma warning disable RECS0029 // here +#pragma warning restore RECS0029 /* end */ + + public static void Main () + { + return; + } +} \ No newline at end of file diff --git a/mcs/tests/ver-il-net_4_x.xml b/mcs/tests/ver-il-net_4_x.xml index f49ba8fbf11..77762b44440 100644 --- a/mcs/tests/ver-il-net_4_x.xml +++ b/mcs/tests/ver-il-net_4_x.xml @@ -67420,6 +67420,19 @@ + + + + 7 + + + 7 + + + 7 + + + -- 2.25.1