From 908fe12544b125d37323e6c52072213b7f6154c2 Mon Sep 17 00:00:00 2001 From: Austin Henriksen Date: Wed, 4 Dec 2024 09:18:02 -0500 Subject: [PATCH] Remove the ability to suppress invalid metadata warnings (as a category). (#3227) --- cpp/src/Slice/MetadataValidation.cpp | 2 +- cpp/src/Slice/Parser.cpp | 4 - cpp/test/Ice/defaultValue/Test.ice | 4 +- .../WarningSuppressInvalidMetadata.err | 0 .../WarningSuppressInvalidMetadata.ice | 102 ------------------ cpp/test/Slice/escape/Key.ice | 6 +- csharp/test/Ice/defaultValue/Test.ice | 11 +- csharp/test/Ice/stream/Test.ice | 10 +- csharp/test/Slice/escape/Key.ice | 5 +- .../src/main/java/test/Slice/escape/Key.ice | 7 +- js/test/Ice/stream/Test.ice | 9 +- php/test/Slice/escape/Key.ice | 6 +- python/test/Slice/escape/Key.ice | 6 +- ruby/test/Slice/escape/Key.ice | 6 +- swift/test/Ice/proxy/Test.ice | 3 +- swift/test/Ice/stream/Test.ice | 6 +- swift/test/Slice/escape/Key.ice | 1 - 17 files changed, 19 insertions(+), 169 deletions(-) delete mode 100644 cpp/test/Slice/errorDetection/WarningSuppressInvalidMetadata.err delete mode 100644 cpp/test/Slice/errorDetection/WarningSuppressInvalidMetadata.ice diff --git a/cpp/src/Slice/MetadataValidation.cpp b/cpp/src/Slice/MetadataValidation.cpp index 6069baa23f4..87b93e99ad8 100644 --- a/cpp/src/Slice/MetadataValidation.cpp +++ b/cpp/src/Slice/MetadataValidation.cpp @@ -123,7 +123,7 @@ Slice::validateMetadata(const UnitPtr& p, string_view prefix, map Blob; - -// Providing a message to 'deprecated' is optional, but it cannot be applied twice to the same thing. -["deprecated", "deprecated:do not use this"] -class Container -{ - // Unknown local metadata is disallowed. - ["unknown", "cpp:unknown", "bad:unknown"] - bool b; - - // Ignore metadata that has a valid language prefix, but that doesn't match the current compiler. - ["php:unknown"] - int i; - - // Passing an argument to metadata that doesn't take arguments is disallowed. - ["protected:foo", "cpp:array:foo"] - Blob blob; -} - -interface I -{ - ["cpp:type:std::list<::std::string>"] - void op1(); - - ["cpp:array"] - void op2(); - - void op3(["cpp:type:my_string"] string s); - - void op4(["cpp:view-type:my_string"] string s); - - // Certain metadata restrict what arguments are valid; 'something' is not a valid format. - // It is also disallowed to pass multiple arguments to metadata which only expects one. - // And this will also trigger a duplicate metadata warning. All 3 warnings should be emitted from this. - ["format:something", "format:default, sliced"] - void op5(); -} - -["cpp:const", "cpp:ice_print"] -struct S -{ - int i; -} - -["cpp:virtual"] -exception E -{ -} - -["bad", "cpp:nope", "java:bad"] // We skip metadata that has a valid (but inapplicable) language prefix. -class C -{ -} - -["cpp98:foo", "cpp11:bar"] // We still warn for unknown language prefixes (cpp98 and cpp11 metadata were removed in 3.8) -class P -{ -} - -} diff --git a/cpp/test/Slice/escape/Key.ice b/cpp/test/Slice/escape/Key.ice index 37abde3e015..af79588eaec 100644 --- a/cpp/test/Slice/escape/Key.ice +++ b/cpp/test/Slice/escape/Key.ice @@ -1,8 +1,4 @@ -// -// Copyright (c) ZeroC, Inc. All rights reserved. -// - -[["suppress-warning:deprecated"]] +// Copyright (c) ZeroC, Inc. module and { diff --git a/csharp/test/Ice/defaultValue/Test.ice b/csharp/test/Ice/defaultValue/Test.ice index e7a780cddcc..ea3f49d866a 100644 --- a/csharp/test/Ice/defaultValue/Test.ice +++ b/csharp/test/Ice/defaultValue/Test.ice @@ -1,15 +1,10 @@ -// -// Copyright (c) ZeroC, Inc. All rights reserved. -// +// Copyright (c) ZeroC, Inc. #pragma once -// -// Suppress warnings -// -[["suppress-warning:invalid-metadata, deprecated"]] -["cs:namespace:Ice.defaultValue"] +[["suppress-warning:deprecated"]] // For enumerator references +["cs:namespace:Ice.defaultValue"] module Test { diff --git a/csharp/test/Ice/stream/Test.ice b/csharp/test/Ice/stream/Test.ice index 320f42d3da7..ed4e27ff6f3 100644 --- a/csharp/test/Ice/stream/Test.ice +++ b/csharp/test/Ice/stream/Test.ice @@ -1,13 +1,9 @@ -// -// Copyright (c) ZeroC, Inc. All rights reserved. -// +// Copyright (c) ZeroC, Inc. #pragma once -// -// Suppress invalid metadata warnings -// -[["suppress-warning:invalid-metadata"]] +// Suppress invalid metadata warnings which we expect this test to generate. +[["suppress-warning"]] #include "Ice/BuiltinSequences.ice" diff --git a/csharp/test/Slice/escape/Key.ice b/csharp/test/Slice/escape/Key.ice index 07489d5f413..915ed11cc03 100644 --- a/csharp/test/Slice/escape/Key.ice +++ b/csharp/test/Slice/escape/Key.ice @@ -1,10 +1,7 @@ -// -// Copyright (c) ZeroC, Inc. All rights reserved. -// +// Copyright (c) ZeroC, Inc. #pragma once -[["suppress-warning:deprecated"]] module abstract { diff --git a/java/test/src/main/java/test/Slice/escape/Key.ice b/java/test/src/main/java/test/Slice/escape/Key.ice index 944c318e3f1..2c05fe4c958 100644 --- a/java/test/src/main/java/test/Slice/escape/Key.ice +++ b/java/test/src/main/java/test/Slice/escape/Key.ice @@ -1,10 +1,9 @@ -// -// Copyright (c) ZeroC, Inc. All rights reserved. -// +// Copyright (c) ZeroC, Inc. #pragma once -[["java:package:test.Slice.escape", "suppress-warning:deprecated"]] +[["java:package:test.Slice.escape"]] + module abstract { diff --git a/js/test/Ice/stream/Test.ice b/js/test/Ice/stream/Test.ice index 3025f96a28e..faff7ea6bd9 100644 --- a/js/test/Ice/stream/Test.ice +++ b/js/test/Ice/stream/Test.ice @@ -1,14 +1,7 @@ -// -// Copyright (c) ZeroC, Inc. All rights reserved. -// +// Copyright (c) ZeroC, Inc. #pragma once -// -// Suppress invalid metadata warnings -// -[["suppress-warning:invalid-metadata, deprecated"]] - #include "Ice/BuiltinSequences.ice" module Test diff --git a/php/test/Slice/escape/Key.ice b/php/test/Slice/escape/Key.ice index a3e5a4dee28..5bcffb4cedf 100644 --- a/php/test/Slice/escape/Key.ice +++ b/php/test/Slice/escape/Key.ice @@ -1,8 +1,4 @@ -// -// Copyright (c) ZeroC, Inc. All rights reserved. -// - -[["suppress-warning:deprecated"]] +// Copyright (c) ZeroC, Inc. module and { diff --git a/python/test/Slice/escape/Key.ice b/python/test/Slice/escape/Key.ice index fdff1db3eb0..cb538287f49 100644 --- a/python/test/Slice/escape/Key.ice +++ b/python/test/Slice/escape/Key.ice @@ -1,8 +1,4 @@ -// -// Copyright (c) ZeroC, Inc. All rights reserved. -// - -[["suppress-warning:deprecated"]] +// Copyright (c) ZeroC, Inc. module and { diff --git a/ruby/test/Slice/escape/Key.ice b/ruby/test/Slice/escape/Key.ice index 116fd417477..c55f3ed254c 100644 --- a/ruby/test/Slice/escape/Key.ice +++ b/ruby/test/Slice/escape/Key.ice @@ -1,8 +1,4 @@ -// -// Copyright (c) ZeroC, Inc. All rights reserved. -// - -[["suppress-warning:deprecated"]] +// Copyright (c) ZeroC, Inc. module BEGIN { diff --git a/swift/test/Ice/proxy/Test.ice b/swift/test/Ice/proxy/Test.ice index 19cfa488789..065d1c3d4e5 100644 --- a/swift/test/Ice/proxy/Test.ice +++ b/swift/test/Ice/proxy/Test.ice @@ -1,10 +1,9 @@ // Copyright (c) ZeroC, Inc. + #pragma once #include "Ice/Context.ice" -[["suppress-warning:deprecated"]] - module Test { diff --git a/swift/test/Ice/stream/Test.ice b/swift/test/Ice/stream/Test.ice index 8deccdef4f5..d9a55548a22 100644 --- a/swift/test/Ice/stream/Test.ice +++ b/swift/test/Ice/stream/Test.ice @@ -1,13 +1,9 @@ // Copyright (c) ZeroC, Inc. + #pragma once #include "Ice/BuiltinSequences.ice" -// -// Suppress invalid metadata warnings -// -[["suppress-warning:invalid-metadata"]] - [["swift:class-resolver-prefix:IceStrem"]] module Test { diff --git a/swift/test/Slice/escape/Key.ice b/swift/test/Slice/escape/Key.ice index 277a40e4273..db5b7f20d64 100644 --- a/swift/test/Slice/escape/Key.ice +++ b/swift/test/Slice/escape/Key.ice @@ -1,5 +1,4 @@ // Copyright (c) ZeroC, Inc. -[["suppress-warning:deprecated"]] module and {