Skip to content

engine/common/settings.h has excessive padding bytes (108), requiring a lint silence #138750

@matanlurey

Description

@matanlurey

In the process of enabling clang-tidy to run on header files, I ran into struct Settings. This is a huge scary struct, so I'm not going to attempt to re-write it as part of turning on clang-tidy.

The error message at the time of filing this issue was:

Failures for clang-tidy on /b/s/w/ir/cache/builder/src/flutter/flow/frame_timings.cc:
../../flutter/common/settings.h:93:8: error: Excessive padding in 'struct flutter::Settings' (108 padding bytes, where 12 is optimal). Optimal fields order: vm_snapshot_data, vm_snapshot_instr, isolate_snapshot_data, isolate_snapshot_instr, dart_library_sources_kernel, application_kernels, task_observer_add, task_observer_remove, root_isolate_create_callback, isolate_create_callback, root_isolate_shutdown_callback, isolate_shutdown_callback, service_isolate_create_callback, idle_notification_callback, unhandled_exception_callback, log_message_callback, icu_mapper, frame_rasterized_callback, old_gen_heap_size, resource_cache_max_bytes_threshold, persistent_isolate_data, vm_snapshot_data_path, vm_snapshot_instr_path, isolate_snapshot_data_path, isolate_snapshot_instr_path, route, application_library_path, vmservice_snapshot_library_path, application_kernel_asset, application_kernel_list_asset, temp_directory_path, dart_flags, trace_allowlist, trace_to_file, domain_network_policy, advisory_script_uri, advisory_script_entrypoint, executable_name, vm_service_host, log_tag, icu_data_path, assets_path, trace_skia_allowlist, impeller_backend, vm_service_port, font_initialization_data, assets_dir, enable_checked_mode, start_paused, trace_skia, trace_startup, trace_systrace, enable_timeline_event_handler, dump_skp_on_shader_compilation, cache_sksl, purge_persistent_cache, endless_trace_buffer, enable_dart_profiling, disable_dart_asserts, enable_serial_gc, may_insecurely_connect_to_all_domains, enable_vm_service, enable_vm_service_publication, disable_service_auth_codes, enable_service_port_fallback, use_test_fonts, use_asset_fonts, prefetched_default_font_manager, enable_wide_gamut, enable_impeller, enable_vulkan_validation, enable_opengl_gpu_tracing, leak_vm, enable_software_rendering, skia_deterministic_rendering_on_cpu, verbose_logging, icu_initialization_required, msaa_samples, enable_embedder_api, consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding,-warnings-as-errors]
   93 | struct Settings {
      | ~~~~~~~^~~~~~~~~~
   94 |   Settings();
      |   ~~~~~~~~~~~
   95 | 
   96 |   Settings(const Settings& other);
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   97 | 
   98 |   ~Settings();
      |   ~~~~~~~~~~~~
   99 | 
  100 |   /// Determines if attempts at grabbing the Surface's SurfaceData can be
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  101 |   /// attempted.
      |   ~~~~~~~~~~~~~~
  102 |   static constexpr bool kSurfaceDataAccessible =
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  103 | #ifdef _NDEBUG
      | ~~~~~~~~~~~~~~
  104 |       false;
      |       ~~~~~~
  105 | #else
      | ~~~~~
  106 |       true;
      |       ~~~~~
  107 | #endif
      | ~~~~~~
  108 | 
../../flutter/common/settings.h:93:8: note: Excessive padding in 'struct flutter::Settings' (108 padding bytes, where 12 is optimal). Optimal fields order: vm_snapshot_data, vm_snapshot_instr, isolate_snapshot_data, isolate_snapshot_instr, dart_library_sources_kernel, application_kernels, task_observer_add, task_observer_remove, root_isolate_create_callback, isolate_create_callback, root_isolate_shutdown_callback, isolate_shutdown_callback, service_isolate_create_callback, idle_notification_callback, unhandled_exception_callback, log_message_callback, icu_mapper, frame_rasterized_callback, old_gen_heap_size, resource_cache_max_bytes_threshold, persistent_isolate_data, vm_snapshot_data_path, vm_snapshot_instr_path, isolate_snapshot_data_path, isolate_snapshot_instr_path, route, application_library_path, vmservice_snapshot_library_path, application_kernel_asset, application_kernel_list_asset, temp_directory_path, dart_flags, trace_allowlist, trace_to_file, domain_network_policy, advisory_script_uri, advisory_script_entrypoint, executable_name, vm_service_host, log_tag, icu_data_path, assets_path, trace_skia_allowlist, impeller_backend, vm_service_port, font_initialization_data, assets_dir, enable_checked_mode, start_paused, trace_skia, trace_startup, trace_systrace, enable_timeline_event_handler, dump_skp_on_shader_compilation, cache_sksl, purge_persistent_cache, endless_trace_buffer, enable_dart_profiling, disable_dart_asserts, enable_serial_gc, may_insecurely_connect_to_all_domains, enable_vm_service, enable_vm_service_publication, disable_service_auth_codes, enable_service_port_fallback, use_test_fonts, use_asset_fonts, prefetched_default_font_manager, enable_wide_gamut, enable_impeller, enable_vulkan_validation, enable_opengl_gpu_tracing, leak_vm, enable_software_rendering, skia_deterministic_rendering_on_cpu, verbose_logging, icu_initialization_required, msaa_samples, enable_embedder_api, consider reordering the fields or adding explicit padding members
   93 | struct Settings {
      | ~~~~~~~^~~~~~~~~~
   94 |   Settings();
      |   ~~~~~~~~~~~
   95 | 
   96 |   Settings(const Settings& other);
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   97 | 
   98 |   ~Settings();
      |   ~~~~~~~~~~~~
   99 | 
  100 |   /// Determines if attempts at grabbing the Surface's SurfaceData can be
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  101 |   /// attempted.
      |   ~~~~~~~~~~~~~~
  102 |   static constexpr bool kSurfaceDataAccessible =
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  103 | #ifdef _NDEBUG
      | ~~~~~~~~~~~~~~
  104 |       false;
      |       ~~~~~~
  105 | #else
      | ~~~~~
  106 |       true;
      |       ~~~~~
  107 | #endif
      | ~~~~~~
  108 | 

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listc: tech-debtTechnical debt, code quality, testing, etc.engineflutter/engine related. See also e: labels.team-engineOwned by Engine teamtriaged-engineTriaged by Engine team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions