Skip to content

Commit d3c1148

Browse files
committed
Enable clang-format for formatted targets in cuttlefish
Enable clang_format_enabled = True for all cf_cc_* targets under base/cvd/cuttlefish that only contain files that are already formatted correctly. Also fix a duplicate header in cvdalloc/BUILD.bazel. Bug: b/512215781 Assisted-by: gemini-next:current
1 parent a094c8e commit d3c1148

76 files changed

Lines changed: 411 additions & 1 deletion

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

base/cvd/cuttlefish/common/libs/concurrency/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ cf_cc_library(
1111
"semaphore.h",
1212
"thread_safe_queue.h",
1313
],
14+
clang_format_enabled = True,
1415
deps = ["@abseil-cpp//absl/log:check"],
1516
)

base/cvd/cuttlefish/common/libs/fs/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ cf_cc_library(
88
name = "epoll",
99
srcs = ["epoll.cpp"],
1010
hdrs = ["epoll.h"],
11+
clang_format_enabled = True,
1112
target_compatible_with = [
1213
"@platforms//os:linux",
1314
],

base/cvd/cuttlefish/common/libs/security/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ cf_cc_library(
1212
hdrs = [
1313
"confui_sign.h",
1414
],
15+
clang_format_enabled = True,
1516
deps = [
1617
"//cuttlefish/common/libs/fs",
1718
"//libbase",
@@ -22,4 +23,5 @@ cf_cc_library(
2223
cf_cc_library(
2324
name = "oemlock",
2425
hdrs = ["oemlock.h"],
26+
clang_format_enabled = True,
2527
)

base/cvd/cuttlefish/common/libs/sensors/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ cf_cc_library(
99
hdrs = [
1010
"sensors.h",
1111
],
12+
clang_format_enabled = True,
1213
)

base/cvd/cuttlefish/common/libs/utils/BUILD.bazel

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ cf_cc_library(
2222
name = "base64",
2323
srcs = ["base64.cpp"],
2424
hdrs = ["base64.h"],
25+
clang_format_enabled = True,
2526
deps = [
2627
"//cuttlefish/result:expect",
2728
"//cuttlefish/result:result_type",
@@ -42,6 +43,7 @@ cf_cc_test(
4243
cf_cc_library(
4344
name = "cf_endian",
4445
hdrs = ["cf_endian.h"],
46+
clang_format_enabled = True,
4547
deps = [
4648
"//libbase",
4749
],
@@ -51,18 +53,21 @@ cf_cc_library(
5153
name = "container",
5254
srcs = ["container.cpp"],
5355
hdrs = ["container.h"],
56+
clang_format_enabled = True,
5457
deps = ["//cuttlefish/common/libs/utils:files"],
5558
)
5659

5760
cf_cc_library(
5861
name = "contains",
5962
hdrs = ["contains.h"],
63+
clang_format_enabled = True,
6064
)
6165

6266
cf_cc_library(
6367
name = "device_type",
6468
srcs = ["device_type.cpp"],
6569
hdrs = ["device_type.h"],
70+
clang_format_enabled = True,
6671
deps = [
6772
"@abseil-cpp//absl/strings",
6873
],
@@ -91,6 +96,7 @@ cf_cc_library(
9196
"environment.h",
9297
"known_paths.h",
9398
],
99+
clang_format_enabled = True,
94100
deps = [
95101
"//libbase",
96102
],
@@ -99,6 +105,7 @@ cf_cc_library(
99105
cf_cc_test(
100106
name = "environment_test",
101107
srcs = ["environment_test.cpp"],
108+
clang_format_enabled = True,
102109
deps = [
103110
":environment",
104111
"@abseil-cpp//absl/cleanup",
@@ -133,6 +140,7 @@ cf_cc_library(
133140
cf_cc_test(
134141
name = "files_test",
135142
srcs = ["files_test.cpp"],
143+
clang_format_enabled = True,
136144
deps = [
137145
"//cuttlefish/common/libs/utils:files",
138146
"//cuttlefish/result",
@@ -147,6 +155,7 @@ cf_cc_library(
147155
name = "flags_validator",
148156
srcs = ["flags_validator.cpp"],
149157
hdrs = ["flags_validator.h"],
158+
clang_format_enabled = True,
150159
deps = [
151160
"//cuttlefish/result",
152161
],
@@ -156,6 +165,7 @@ cf_cc_library(
156165
name = "gflags_xml_parser",
157166
srcs = ["gflags_xml_parser.cpp"],
158167
hdrs = ["gflags_xml_parser.h"],
168+
clang_format_enabled = True,
159169
features = ["-layering_check"],
160170
deps = [
161171
"//cuttlefish/result",
@@ -166,6 +176,7 @@ cf_cc_library(
166176
cf_cc_test(
167177
name = "gflags_xml_parser_test",
168178
srcs = ["gflags_xml_parser_test.cpp"],
179+
clang_format_enabled = True,
169180
deps = [
170181
":gflags_xml_parser",
171182
"//cuttlefish/result:result_matchers",
@@ -188,12 +199,14 @@ cf_cc_library(
188199
name = "in_sandbox",
189200
srcs = ["in_sandbox.cpp"],
190201
hdrs = ["in_sandbox.h"],
202+
clang_format_enabled = True,
191203
)
192204

193205
cf_cc_library(
194206
name = "inotify",
195207
srcs = ["inotify.cpp"],
196208
hdrs = ["inotify.h"],
209+
clang_format_enabled = True,
197210
target_compatible_with = [
198211
"@platforms//os:linux",
199212
],
@@ -207,6 +220,7 @@ cf_cc_library(
207220
name = "is_google_corp",
208221
srcs = ["is_google_corp.cpp"],
209222
hdrs = ["is_google_corp.h"],
223+
clang_format_enabled = True,
210224
deps = [
211225
"//cuttlefish/common/libs/utils:files",
212226
],
@@ -216,6 +230,7 @@ cf_cc_library(
216230
name = "json",
217231
srcs = ["json.cpp"],
218232
hdrs = ["json.h"],
233+
clang_format_enabled = True,
219234
deps = [
220235
"//cuttlefish/common/libs/fs",
221236
"//cuttlefish/result",
@@ -242,13 +257,15 @@ cf_cc_library(
242257
cf_cc_test(
243258
name = "network_test",
244259
srcs = ["network_test.cpp"],
260+
clang_format_enabled = True,
245261
deps = [":network"],
246262
)
247263

248264
cf_cc_library(
249265
name = "proc_file_utils",
250266
srcs = ["proc_file_utils.cpp"],
251267
hdrs = ["proc_file_utils.h"],
268+
clang_format_enabled = True,
252269
deps = [
253270
"//cuttlefish/common/libs/fs",
254271
"//cuttlefish/common/libs/utils:files",
@@ -263,6 +280,7 @@ cf_cc_library(
263280
cf_cc_test(
264281
name = "proc_file_utils_test",
265282
srcs = ["proc_file_utils_test.cpp"],
283+
clang_format_enabled = True,
266284
deps = [
267285
"//cuttlefish/common/libs/utils:contains",
268286
"//cuttlefish/common/libs/utils:proc_file_utils",
@@ -273,6 +291,7 @@ cf_cc_test(
273291
cf_cc_library(
274292
name = "proto",
275293
hdrs = ["proto.h"],
294+
clang_format_enabled = True,
276295
deps = [
277296
"@fmt",
278297
"@protobuf",
@@ -294,6 +313,7 @@ cf_cc_library(
294313
name = "semver",
295314
srcs = ["semver.cpp"],
296315
hdrs = ["semver.h"],
316+
clang_format_enabled = True,
297317
deps = [
298318
"//cuttlefish/result",
299319
"//cuttlefish/result:expect",
@@ -304,6 +324,7 @@ cf_cc_library(
304324
cf_cc_test(
305325
name = "semver_test",
306326
srcs = ["semver_test.cpp"],
327+
clang_format_enabled = True,
307328
deps = [
308329
"//cuttlefish/common/libs/utils:semver",
309330
"//cuttlefish/result:result_matchers",
@@ -324,6 +345,7 @@ cf_cc_library(
324345
cf_cc_library(
325346
name = "size_utils",
326347
hdrs = ["size_utils.h"],
348+
clang_format_enabled = True,
327349
)
328350

329351
cf_cc_library(
@@ -344,6 +366,7 @@ cf_cc_library(
344366
name = "subprocess",
345367
srcs = ["subprocess.cpp"],
346368
hdrs = ["subprocess.h"],
369+
clang_format_enabled = True,
347370
deps = [
348371
"//cuttlefish/common/libs/fs",
349372
"//cuttlefish/common/libs/utils:contains",
@@ -394,6 +417,7 @@ cf_cc_library(
394417
cf_cc_library(
395418
name = "type_name",
396419
hdrs = ["type_name.h"],
420+
clang_format_enabled = True,
397421
)
398422

399423
cf_cc_library(
@@ -404,6 +428,7 @@ cf_cc_library(
404428
hdrs = [
405429
"uuid.h",
406430
],
431+
clang_format_enabled = True,
407432
deps = [
408433
"@libuuid",
409434
],
@@ -413,6 +438,7 @@ cf_cc_library(
413438
name = "unix_sockets",
414439
srcs = ["unix_sockets.cpp"],
415440
hdrs = ["unix_sockets.h"],
441+
clang_format_enabled = True,
416442
deps = [
417443
"//cuttlefish/common/libs/fs",
418444
"//cuttlefish/result",
@@ -425,6 +451,7 @@ cf_cc_library(
425451
cf_cc_test(
426452
name = "unix_sockets_test",
427453
srcs = ["unix_sockets_test.cpp"],
454+
clang_format_enabled = True,
428455
deps = [
429456
"//cuttlefish/common/libs/fs",
430457
"//cuttlefish/common/libs/utils:unix_sockets",
@@ -466,6 +493,7 @@ cf_cc_library(
466493
name = "wait_for_file",
467494
srcs = ["wait_for_file.cc"],
468495
hdrs = ["wait_for_file.h"],
496+
clang_format_enabled = True,
469497
deps = [
470498
"//cuttlefish/common/libs/utils:contains",
471499
"//cuttlefish/common/libs/utils:files",

base/cvd/cuttlefish/flag_parser/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ cf_cc_library(
3838
name = "shared_fd_flag",
3939
srcs = ["shared_fd_flag.cpp"],
4040
hdrs = ["shared_fd_flag.h"],
41+
clang_format_enabled = True,
4142
deps = [
4243
":flag_parser",
4344
"//cuttlefish/common/libs/fs",

base/cvd/cuttlefish/host/commands/assemble_cvd/BUILD.bazel

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ cf_cc_library(
182182
name = "create_dynamic_disk_files",
183183
srcs = ["create_dynamic_disk_files.cc"],
184184
hdrs = ["create_dynamic_disk_files.h"],
185+
clang_format_enabled = True,
185186
deps = [
186187
"//cuttlefish/common/libs/utils:files",
187188
"//cuttlefish/host/commands/assemble_cvd:assemble_cvd_flags",
@@ -235,6 +236,7 @@ cf_cc_library(
235236
name = "disk_builder",
236237
srcs = ["disk_builder.cpp"],
237238
hdrs = ["disk_builder.h"],
239+
clang_format_enabled = True,
238240
deps = [
239241
"//cuttlefish/common/libs/utils:files",
240242
"//cuttlefish/host/libs/config:vmm_mode",
@@ -375,6 +377,7 @@ cf_cc_library(
375377
hdrs = [
376378
"flags_defaults.h",
377379
],
380+
clang_format_enabled = True,
378381
copts = COPTS + ["-Werror=sign-compare"],
379382
deps = [
380383
"//cuttlefish/common/libs/utils:environment",
@@ -449,6 +452,7 @@ cf_cc_library(
449452
name = "kernel_module_parser",
450453
srcs = ["kernel_module_parser.cc"],
451454
hdrs = ["kernel_module_parser.h"],
455+
clang_format_enabled = True,
452456
deps = [
453457
"//cuttlefish/io",
454458
"//cuttlefish/io:string",
@@ -460,6 +464,7 @@ cf_cc_library(
460464
cf_cc_test(
461465
name = "kernel_module_parser_test",
462466
srcs = ["kernel_module_parser_test.cc"],
467+
clang_format_enabled = True,
463468
deps = [
464469
"//cuttlefish/host/commands/assemble_cvd:kernel_module_parser",
465470
"//cuttlefish/io",
@@ -492,6 +497,7 @@ cf_cc_library(
492497
name = "instance_image_files",
493498
srcs = ["instance_image_files.cc"],
494499
hdrs = ["instance_image_files.h"],
500+
clang_format_enabled = True,
495501
deps = [
496502
"//cuttlefish/host/commands/assemble_cvd/disk:efi_loader",
497503
"//cuttlefish/host/commands/assemble_cvd/disk:image_file",
@@ -523,6 +529,7 @@ cf_cc_library(
523529
name = "network_flags",
524530
srcs = ["network_flags.cpp"],
525531
hdrs = ["network_flags.h"],
532+
clang_format_enabled = True,
526533
deps = [
527534
"//cuttlefish/host/commands/cvdalloc:interface",
528535
"//cuttlefish/host/libs/config:cuttlefish_config",
@@ -538,6 +545,7 @@ cf_cc_library(
538545
name = "required_directories",
539546
srcs = ["required_directories.cc"],
540547
hdrs = ["required_directories.h"],
548+
clang_format_enabled = True,
541549
deps = [
542550
"//cuttlefish/host/libs/config:config_constants",
543551
"//cuttlefish/host/libs/config:cuttlefish_config",

0 commit comments

Comments
 (0)