@@ -1412,24 +1412,17 @@ bool HasFieldPresence(const GeneratorOptions& options,
14121412// were the final one for a given filename.
14131413class FileDeduplicator {
14141414 public:
1415- explicit FileDeduplicator (const GeneratorOptions& options)
1416- : error_on_conflict_(options.error_on_name_conflict) {}
1415+ explicit FileDeduplicator (const GeneratorOptions& options) {}
14171416
14181417 // params:
14191418 // filenames: a pair of {short filename, full filename}
14201419 // (short filename don't have extra information, full filename
14211420 // contains extra information)
14221421 // desc: The Descriptor or SCC pointer or EnumDescriptor.
1423- // error: The returned error information.
14241422 bool AddFile (const std::pair<std::string, std::string> filenames,
1425- const void * desc, std::string* error ) {
1423+ const void * desc) {
14261424 if (descs_by_shortname_.find (filenames.first ) !=
14271425 descs_by_shortname_.end ()) {
1428- if (error_on_conflict_) {
1429- *error = " Name conflict: file name " + filenames.first +
1430- " would be generated by two descriptors" ;
1431- return false ;
1432- }
14331426 // Change old pointer's actual name to full name.
14341427 auto short_name_desc = descs_by_shortname_[filenames.first ];
14351428 allowed_descs_actual_name_[short_name_desc] =
@@ -1447,7 +1440,6 @@ class FileDeduplicator {
14471440 }
14481441
14491442 private:
1450- bool error_on_conflict_;
14511443 // The map that restores all the descs that are using short name as filename.
14521444 std::map<std::string, const void *> descs_by_shortname_;
14531445 // The final actual filename map.
@@ -1541,8 +1533,7 @@ struct DepsGenerator {
15411533bool GenerateJspbAllowedMap (const GeneratorOptions& options,
15421534 const std::vector<const FileDescriptor*>& files,
15431535 std::map<const void *, std::string>* allowed_set,
1544- SCCAnalyzer<DepsGenerator>* analyzer,
1545- std::string* error) {
1536+ SCCAnalyzer<DepsGenerator>* analyzer) {
15461537 std::vector<const FileDescriptor*> files_ordered;
15471538 GenerateJspbFileOrder (files, &files_ordered);
15481539
@@ -1557,15 +1548,15 @@ bool GenerateJspbAllowedMap(const GeneratorOptions& options,
15571548 std::make_pair (
15581549 GetMessagesFileName (options, analyzer->GetSCC (desc), false ),
15591550 GetMessagesFileName (options, analyzer->GetSCC (desc), true )),
1560- analyzer->GetSCC (desc), error )) {
1551+ analyzer->GetSCC (desc))) {
15611552 return false ;
15621553 }
15631554 }
15641555 for (int j = 0 ; j < files_ordered[i]->enum_type_count (); j++) {
15651556 const EnumDescriptor* desc = files_ordered[i]->enum_type (j);
15661557 if (!dedup.AddFile (std::make_pair (GetEnumFileName (options, desc, false ),
15671558 GetEnumFileName (options, desc, true )),
1568- desc, error )) {
1559+ desc)) {
15691560 return false ;
15701561 }
15711562 }
@@ -1584,7 +1575,7 @@ bool GenerateJspbAllowedMap(const GeneratorOptions& options,
15841575 std::make_pair (
15851576 GetExtensionFileName (options, files_ordered[i], false ),
15861577 GetExtensionFileName (options, files_ordered[i], true )),
1587- files_ordered[i], error )) {
1578+ files_ordered[i])) {
15881579 return false ;
15891580 }
15901581 }
@@ -3477,12 +3468,10 @@ bool GeneratorOptions::ParseFromOptions(
34773468 return false ;
34783469 }
34793470 testonly = true ;
3471+
34803472 } else if (options[i].first == " error_on_name_conflict" ) {
3481- if (options[i].second != " " ) {
3482- *error = " Unexpected option value for error_on_name_conflict" ;
3483- return false ;
3484- }
3485- error_on_name_conflict = true ;
3473+ GOOGLE_LOG (WARNING) << " Ignoring error_on_name_conflict option, this "
3474+ " will be removed in a future release" ;
34863475 } else if (options[i].first == " output_dir" ) {
34873476 output_dir = options[i].second ;
34883477 } else if (options[i].first == " namespace_prefix" ) {
@@ -3531,11 +3520,10 @@ bool GeneratorOptions::ParseFromOptions(
35313520
35323521 if (import_style != kImportClosure &&
35333522 (add_require_for_enums || testonly || !library.empty () ||
3534- error_on_name_conflict || extension != " .js" ||
3535- one_output_file_per_input_file)) {
3523+ extension != " .js" || one_output_file_per_input_file)) {
35363524 *error =
3537- " The add_require_for_enums, testonly, library, error_on_name_conflict, "
3538- " extension, and one_output_file_per_input_file options should only be "
3525+ " The add_require_for_enums, testonly, library, extension, and "
3526+ " one_output_file_per_input_file options should only be "
35393527 " used for import_style=closure" ;
35403528 return false ;
35413529 }
@@ -3770,8 +3758,7 @@ bool Generator::GenerateAll(const std::vector<const FileDescriptor*>& files,
37703758 std::set<const Descriptor*> have_printed;
37713759 SCCAnalyzer<DepsGenerator> analyzer;
37723760 std::map<const void *, std::string> allowed_map;
3773- if (!GenerateJspbAllowedMap (options, files, &allowed_map, &analyzer,
3774- error)) {
3761+ if (!GenerateJspbAllowedMap (options, files, &allowed_map, &analyzer)) {
37753762 return false ;
37763763 }
37773764
0 commit comments