Skip to content

Commit 5fbe620

Browse files
committed
src: unguard the experimental_quic_ option field
When configured to build `--without_ssl`, having the experimental_quic_ option field guarded was causing an ODR violation in the 'node_options.h` header causing a misalignment in the struct depending on the number of bool fields defined. There's no need to guard the field, only the registration of the option itself.
1 parent 6591f5e commit 5fbe620

File tree

1 file changed

+21
-24
lines changed

1 file changed

+21
-24
lines changed

src/node_options.h

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,7 @@ class EnvironmentOptions : public Options {
129129
bool experimental_sqlite = true;
130130
bool experimental_stream_iter = false;
131131
bool webstorage = HAVE_SQLITE;
132-
#ifndef OPENSSL_NO_QUIC
133132
bool experimental_quic = false;
134-
#endif
135133
std::string localstorage_file;
136134
bool experimental_global_navigator = true;
137135
bool experimental_global_web_crypto = true;
@@ -287,7 +285,7 @@ class PerIsolateOptions : public Options {
287285
PerIsolateOptions() = default;
288286
PerIsolateOptions(PerIsolateOptions&&) = default;
289287

290-
std::shared_ptr<EnvironmentOptions> per_env { new EnvironmentOptions() };
288+
std::shared_ptr<EnvironmentOptions> per_env{new EnvironmentOptions()};
291289
bool track_heap_objects = false;
292290
bool report_uncaught_exception = false;
293291
bool report_on_signal = false;
@@ -320,7 +318,7 @@ class PerProcessOptions : public Options {
320318
// using the node::per_process::cli_options_mutex, typically:
321319
//
322320
// Mutex::ScopedLock lock(node::per_process::cli_options_mutex);
323-
std::shared_ptr<PerIsolateOptions> per_isolate { new PerIsolateOptions() };
321+
std::shared_ptr<PerIsolateOptions> per_isolate{new PerIsolateOptions()};
324322

325323
std::string title;
326324
std::string trace_event_categories;
@@ -474,38 +472,38 @@ class OptionsParser {
474472
void AddOption(
475473
const char* name,
476474
const char* help_text,
477-
bool Options::*field,
475+
bool Options::* field,
478476
OptionEnvvarSettings env_setting = kDisallowedInEnvvar,
479477
bool default_is_true = false,
480478
OptionNamespaces namespace_id = OptionNamespaces::kNoNamespace);
481479
void AddOption(
482480
const char* name,
483481
const char* help_text,
484-
uint64_t Options::*field,
482+
uint64_t Options::* field,
485483
OptionEnvvarSettings env_setting = kDisallowedInEnvvar,
486484
OptionNamespaces namespace_id = OptionNamespaces::kNoNamespace);
487485
void AddOption(
488486
const char* name,
489487
const char* help_text,
490-
int64_t Options::*field,
488+
int64_t Options::* field,
491489
OptionEnvvarSettings env_setting = kDisallowedInEnvvar,
492490
OptionNamespaces namespace_id = OptionNamespaces::kNoNamespace);
493491
void AddOption(
494492
const char* name,
495493
const char* help_text,
496-
std::string Options::*field,
494+
std::string Options::* field,
497495
OptionEnvvarSettings env_setting = kDisallowedInEnvvar,
498496
OptionNamespaces namespace_id = OptionNamespaces::kNoNamespace);
499497
void AddOption(
500498
const char* name,
501499
const char* help_text,
502-
std::vector<std::string> Options::*field,
500+
std::vector<std::string> Options::* field,
503501
OptionEnvvarSettings env_setting = kDisallowedInEnvvar,
504502
OptionNamespaces namespace_id = OptionNamespaces::kNoNamespace);
505503
void AddOption(
506504
const char* name,
507505
const char* help_text,
508-
HostPort Options::*field,
506+
HostPort Options::* field,
509507
OptionEnvvarSettings env_setting = kDisallowedInEnvvar,
510508
OptionNamespaces namespace_id = OptionNamespaces::kNoNamespace);
511509
void AddOption(
@@ -530,8 +528,7 @@ class OptionsParser {
530528
// if the option has a non-option argument (not starting with -) following it.
531529
void AddAlias(const char* from, const char* to);
532530
void AddAlias(const char* from, const std::vector<std::string>& to);
533-
void AddAlias(const char* from,
534-
const std::initializer_list<std::string>& to);
531+
void AddAlias(const char* from, const std::initializer_list<std::string>& to);
535532

536533
// Add implications from some arbitrary option to a boolean one, either
537534
// in a way that makes `from` set `to` to true or to false.
@@ -543,7 +540,7 @@ class OptionsParser {
543540
// type.
544541
template <typename ChildOptions>
545542
void Insert(const OptionsParser<ChildOptions>& child_options_parser,
546-
ChildOptions* (Options::* get_child)());
543+
ChildOptions* (Options::*get_child)());
547544

548545
// Parse a sequence of options into an options struct, a list of
549546
// arguments that were parsed as options, a list of unknown/JS engine options,
@@ -632,17 +629,15 @@ class OptionsParser {
632629
// These are helpers that make `Insert()` support properties of other
633630
// options structs, if we know how to access them.
634631
template <typename OriginalField, typename ChildOptions>
635-
static auto Convert(
636-
std::shared_ptr<OriginalField> original,
637-
ChildOptions* (Options::* get_child)());
632+
static auto Convert(std::shared_ptr<OriginalField> original,
633+
ChildOptions* (Options::*get_child)());
638634
template <typename ChildOptions>
639-
static auto Convert(
640-
typename OptionsParser<ChildOptions>::OptionInfo original,
641-
ChildOptions* (Options::* get_child)());
635+
static auto Convert(typename OptionsParser<ChildOptions>::OptionInfo original,
636+
ChildOptions* (Options::*get_child)());
642637
template <typename ChildOptions>
643638
static auto Convert(
644639
typename OptionsParser<ChildOptions>::Implication original,
645-
ChildOptions* (Options::* get_child)());
640+
ChildOptions* (Options::*get_child)());
646641

647642
std::unordered_map<std::string, OptionInfo> options_;
648643
std::unordered_map<std::string, std::vector<std::string>> aliases_;
@@ -669,10 +664,12 @@ class OptionsParser {
669664

670665
using StringVector = std::vector<std::string>;
671666
template <class OptionsType, class = Options>
672-
void Parse(
673-
StringVector* const args, StringVector* const exec_args,
674-
StringVector* const v8_args, OptionsType* const options,
675-
OptionEnvvarSettings required_env_settings, StringVector* const errors);
667+
void Parse(StringVector* const args,
668+
StringVector* const exec_args,
669+
StringVector* const v8_args,
670+
OptionsType* const options,
671+
OptionEnvvarSettings required_env_settings,
672+
StringVector* const errors);
676673

677674
} // namespace options_parser
678675

0 commit comments

Comments
 (0)