Skip to content

Commit 1042c3c

Browse files
authored
Merge pull request #25172 from protocolbuffers/visibility_upd_fixes
Visibility updates and fix for unused parameters in upb
2 parents 37e29c5 + 0974c89 commit 1042c3c

4 files changed

Lines changed: 70 additions & 1 deletion

File tree

bazel/toolchains/BUILD

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
33

44
package(
55
default_applicable_licenses = ["//:license"],
6-
default_visibility = ["//visibility:public"],
76
)
87

98
bzl_library(
109
name = "proto_toolchain_bzl",
1110
srcs = [
1211
"proto_toolchain.bzl",
1312
],
13+
visibility = ["//visibility:public"],
1414
deps = [
1515
"//bazel/private:proto_toolchain_rule_bzl",
1616
"//bazel/private:toolchain_helpers_bzl",
@@ -22,6 +22,7 @@ bzl_library(
2222
srcs = [
2323
"proto_lang_toolchain.bzl",
2424
],
25+
visibility = ["//visibility:public"],
2526
deps = [
2627
"//bazel/common:proto_common_bzl",
2728
"//bazel/private:proto_lang_toolchain_rule_bzl",
@@ -52,6 +53,7 @@ bool_flag(
5253
config_setting(
5354
name = "prefer_prebuilt_protoc.flag_set",
5455
flag_values = {":prefer_prebuilt_protoc": "true"},
56+
visibility = ["//bazel/private/toolchains/prebuilt:__pkg__"],
5557
)
5658

5759
# The public API users set to disable the validation action failing.
@@ -63,4 +65,5 @@ bool_flag(
6365
config_setting(
6466
name = "allow_nonstandard_protoc.flag_set",
6567
flag_values = {":allow_nonstandard_protoc": "true"},
68+
visibility = ["//bazel/private/toolchains/prebuilt:__pkg__"],
6669
)

php/ext/google/protobuf/php-upb.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -843,6 +843,7 @@ UPB_INLINE uint8_t _upb_Xsan_NextTag(upb_Xsan *xsan) {
843843
}
844844
return xsan->state;
845845
#else
846+
UPB_UNUSED(xsan);
846847
return 0;
847848
#endif
848849
}
@@ -859,13 +860,27 @@ UPB_INLINE uint8_t UPB_PRIVATE(_upb_Xsan_GetTag)(const void *addr) {
859860
#if UPB_HWASAN
860861
return __hwasan_get_tag_from_pointer(addr);
861862
#else
863+
UPB_UNUSED(addr);
862864
return 0;
863865
#endif
864866
}
865867

866868
UPB_INLINE void UPB_PRIVATE(upb_Xsan_Init)(upb_Xsan *xsan) {
867869
#if UPB_HWASAN || UPB_TSAN
868870
xsan->state = 0;
871+
#else
872+
UPB_UNUSED(xsan);
873+
#endif
874+
}
875+
876+
UPB_INLINE void UPB_PRIVATE(upb_Xsan_MarkInitialized)(void* addr, size_t size) {
877+
#if UPB_HAS_FEATURE(memory_sanitizer)
878+
if (size) {
879+
__msan_unpoison(addr, size);
880+
}
881+
#else
882+
UPB_UNUSED(addr);
883+
UPB_UNUSED(size);
869884
#endif
870885
}
871886

@@ -878,6 +893,9 @@ UPB_INLINE void UPB_PRIVATE(upb_Xsan_PoisonRegion)(const void *addr,
878893
__asan_poison_memory_region(addr, size);
879894
#elif UPB_HWASAN
880895
__hwasan_tag_memory(addr, UPB_HWASAN_POISON_TAG, UPB_ALIGN_MALLOC(size));
896+
#else
897+
UPB_UNUSED(addr);
898+
UPB_UNUSED(size);
881899
#endif
882900
}
883901

@@ -955,13 +973,17 @@ UPB_INLINE void UPB_PRIVATE(upb_Xsan_AccessReadOnly)(upb_Xsan *xsan) {
955973
#if UPB_TSAN
956974
// For performance we avoid using a volatile variable.
957975
__asm__ volatile("" ::"r"(xsan->state));
976+
#else
977+
UPB_UNUSED(xsan);
958978
#endif
959979
}
960980

961981
UPB_INLINE void UPB_PRIVATE(upb_Xsan_AccessReadWrite)(upb_Xsan *xsan) {
962982
#if UPB_TSAN
963983
// For performance we avoid using a volatile variable.
964984
__asm__ volatile("" : "+r"(xsan->state));
985+
#else
986+
UPB_UNUSED(xsan);
965987
#endif
966988
}
967989

ruby/ext/google/protobuf_c/ruby-upb.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,7 @@ UPB_INLINE uint8_t _upb_Xsan_NextTag(upb_Xsan *xsan) {
845845
}
846846
return xsan->state;
847847
#else
848+
UPB_UNUSED(xsan);
848849
return 0;
849850
#endif
850851
}
@@ -861,13 +862,27 @@ UPB_INLINE uint8_t UPB_PRIVATE(_upb_Xsan_GetTag)(const void *addr) {
861862
#if UPB_HWASAN
862863
return __hwasan_get_tag_from_pointer(addr);
863864
#else
865+
UPB_UNUSED(addr);
864866
return 0;
865867
#endif
866868
}
867869

868870
UPB_INLINE void UPB_PRIVATE(upb_Xsan_Init)(upb_Xsan *xsan) {
869871
#if UPB_HWASAN || UPB_TSAN
870872
xsan->state = 0;
873+
#else
874+
UPB_UNUSED(xsan);
875+
#endif
876+
}
877+
878+
UPB_INLINE void UPB_PRIVATE(upb_Xsan_MarkInitialized)(void* addr, size_t size) {
879+
#if UPB_HAS_FEATURE(memory_sanitizer)
880+
if (size) {
881+
__msan_unpoison(addr, size);
882+
}
883+
#else
884+
UPB_UNUSED(addr);
885+
UPB_UNUSED(size);
871886
#endif
872887
}
873888

@@ -880,6 +895,9 @@ UPB_INLINE void UPB_PRIVATE(upb_Xsan_PoisonRegion)(const void *addr,
880895
__asan_poison_memory_region(addr, size);
881896
#elif UPB_HWASAN
882897
__hwasan_tag_memory(addr, UPB_HWASAN_POISON_TAG, UPB_ALIGN_MALLOC(size));
898+
#else
899+
UPB_UNUSED(addr);
900+
UPB_UNUSED(size);
883901
#endif
884902
}
885903

@@ -957,13 +975,17 @@ UPB_INLINE void UPB_PRIVATE(upb_Xsan_AccessReadOnly)(upb_Xsan *xsan) {
957975
#if UPB_TSAN
958976
// For performance we avoid using a volatile variable.
959977
__asm__ volatile("" ::"r"(xsan->state));
978+
#else
979+
UPB_UNUSED(xsan);
960980
#endif
961981
}
962982

963983
UPB_INLINE void UPB_PRIVATE(upb_Xsan_AccessReadWrite)(upb_Xsan *xsan) {
964984
#if UPB_TSAN
965985
// For performance we avoid using a volatile variable.
966986
__asm__ volatile("" : "+r"(xsan->state));
987+
#else
988+
UPB_UNUSED(xsan);
967989
#endif
968990
}
969991

upb/port/sanitizers.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ UPB_INLINE uint8_t _upb_Xsan_NextTag(upb_Xsan *xsan) {
3737
}
3838
return xsan->state;
3939
#else
40+
UPB_UNUSED(xsan);
4041
return 0;
4142
#endif
4243
}
@@ -53,13 +54,27 @@ UPB_INLINE uint8_t UPB_PRIVATE(_upb_Xsan_GetTag)(const void *addr) {
5354
#if UPB_HWASAN
5455
return __hwasan_get_tag_from_pointer(addr);
5556
#else
57+
UPB_UNUSED(addr);
5658
return 0;
5759
#endif
5860
}
5961

6062
UPB_INLINE void UPB_PRIVATE(upb_Xsan_Init)(upb_Xsan *xsan) {
6163
#if UPB_HWASAN || UPB_TSAN
6264
xsan->state = 0;
65+
#else
66+
UPB_UNUSED(xsan);
67+
#endif
68+
}
69+
70+
UPB_INLINE void UPB_PRIVATE(upb_Xsan_MarkInitialized)(void* addr, size_t size) {
71+
#if UPB_HAS_FEATURE(memory_sanitizer)
72+
if (size) {
73+
__msan_unpoison(addr, size);
74+
}
75+
#else
76+
UPB_UNUSED(addr);
77+
UPB_UNUSED(size);
6378
#endif
6479
}
6580

@@ -72,6 +87,9 @@ UPB_INLINE void UPB_PRIVATE(upb_Xsan_PoisonRegion)(const void *addr,
7287
__asan_poison_memory_region(addr, size);
7388
#elif UPB_HWASAN
7489
__hwasan_tag_memory(addr, UPB_HWASAN_POISON_TAG, UPB_ALIGN_MALLOC(size));
90+
#else
91+
UPB_UNUSED(addr);
92+
UPB_UNUSED(size);
7593
#endif
7694
}
7795

@@ -149,13 +167,17 @@ UPB_INLINE void UPB_PRIVATE(upb_Xsan_AccessReadOnly)(upb_Xsan *xsan) {
149167
#if UPB_TSAN
150168
// For performance we avoid using a volatile variable.
151169
__asm__ volatile("" ::"r"(xsan->state));
170+
#else
171+
UPB_UNUSED(xsan);
152172
#endif
153173
}
154174

155175
UPB_INLINE void UPB_PRIVATE(upb_Xsan_AccessReadWrite)(upb_Xsan *xsan) {
156176
#if UPB_TSAN
157177
// For performance we avoid using a volatile variable.
158178
__asm__ volatile("" : "+r"(xsan->state));
179+
#else
180+
UPB_UNUSED(xsan);
159181
#endif
160182
}
161183

0 commit comments

Comments
 (0)