|
10 | 10 | #include <cstddef>
|
11 | 11 | #include <cstdlib>
|
12 | 12 | #include <fstream>
|
| 13 | +#include <iostream> |
13 | 14 | #include <memory>
|
14 | 15 | #include <string>
|
15 | 16 | #include <utility>
|
|
18 | 19 | #include "absl/container/flat_hash_set.h"
|
19 | 20 | #include "absl/memory/memory.h"
|
20 | 21 | #include "absl/strings/ascii.h"
|
| 22 | +#include "absl/strings/match.h" |
21 | 23 | #include "absl/strings/str_cat.h"
|
22 | 24 | #include "absl/strings/str_split.h"
|
23 | 25 | #include "absl/strings/string_view.h"
|
@@ -314,6 +316,57 @@ bool ObjectiveCGenerator::GenerateAll(
|
314 | 316 |
|
315 | 317 | // -----------------------------------------------------------------
|
316 | 318 |
|
| 319 | + // NOTE: src/google/protobuf/compiler/plugin.cc makes use of cerr for some |
| 320 | + // error cases, so it seems to be ok to use as a back door for warnings. |
| 321 | + |
| 322 | + // This is a way to turn off these warnings, the intent is that if you find |
| 323 | + // this then you also did as asked and filed an issue so the need for the |
| 324 | + // generation option is known. But it allows you to keep your builds quiet |
| 325 | + // after opening the issue. The value of the environment variable should be |
| 326 | + // a comma separated list of the names of the options to suppress their usage |
| 327 | + // warning. |
| 328 | + char* options_warnings_suppressions_cstr = |
| 329 | + getenv("GPB_OBJC_SUPPRESS_DEPRECATED_OPTIONS_WARNINGS"); |
| 330 | + const absl::string_view options_warnings_suppressions = |
| 331 | + options_warnings_suppressions_cstr != nullptr |
| 332 | + ? options_warnings_suppressions_cstr |
| 333 | + : ""; |
| 334 | + if (generation_options.headers_use_forward_declarations && |
| 335 | + !absl::StrContains(options_warnings_suppressions, |
| 336 | + "headers_use_forward_declarations")) { |
| 337 | + std::cerr << "WARNING: headers_use_forward_declarations is enabled, this " |
| 338 | + "is deprecated and will be removed in the future. If you have " |
| 339 | + "a need for enabling it please file an issue at " |
| 340 | + "https://github.com/protocolbuffers/protobuf/issues with " |
| 341 | + "your use case." |
| 342 | + << std::endl; |
| 343 | + std::cerr.flush(); |
| 344 | + } |
| 345 | + if (!generation_options.generate_minimal_imports && |
| 346 | + !absl::StrContains(options_warnings_suppressions, |
| 347 | + "generate_minimal_imports")) { |
| 348 | + std::cerr << "WARNING: generate_minimal_imports is disabled, this is " |
| 349 | + "deprecated and will be removed in the future. If you have a " |
| 350 | + "need for disabling it please file an issue at " |
| 351 | + "https://github.com/protocolbuffers/protobuf/issues with " |
| 352 | + "your use case." |
| 353 | + << std::endl; |
| 354 | + std::cerr.flush(); |
| 355 | + } |
| 356 | + if (!generation_options.strip_custom_options && |
| 357 | + !absl::StrContains(options_warnings_suppressions, |
| 358 | + "strip_custom_options")) { |
| 359 | + std::cerr << "WARNING: strip_custom_options is disabled, this is deprecated" |
| 360 | + "and will be removed in the future. If you have a need for " |
| 361 | + "disabling it please file an issue at " |
| 362 | + "https://github.com/protocolbuffers/protobuf/issues with " |
| 363 | + "your use case." |
| 364 | + << std::endl; |
| 365 | + std::cerr.flush(); |
| 366 | + } |
| 367 | + |
| 368 | + // ----------------------------------------------------------------- |
| 369 | + |
317 | 370 | // These are not official generation options and could be removed/changed in
|
318 | 371 | // the future and doing that won't count as a breaking change.
|
319 | 372 | bool headers_only = getenv("GPB_OBJC_HEADERS_ONLY") != nullptr;
|
@@ -417,7 +470,7 @@ bool ObjectiveCGenerator::GenerateAll(
|
417 | 470 | }
|
418 | 471 | }
|
419 | 472 | } // if (!headers_only && skip_impls.count(file->name()) == 0)
|
420 |
| - } // for(file : files) |
| 473 | + } // for(file : files) |
421 | 474 |
|
422 | 475 | return true;
|
423 | 476 | }
|
|
0 commit comments