Skip to content

Commit 66ab360

Browse files
NSProgrammerfacebook-github-bot
authored andcommitted
Address -Wswitch-default warnings
Summary: X-link: facebook/react-native#54500 Improve compatibility with projects that have -Wswitch-default errors/warnings enabled by suppressing those errors/warnings in caffe2 headers. Differential Revision: D86785452
1 parent cec299f commit 66ab360

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

yoga/algorithm/FlexDirection.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ inline PhysicalEdge flexStartEdge(FlexDirection flexDirection) {
6060
return PhysicalEdge::Left;
6161
case FlexDirection::RowReverse:
6262
return PhysicalEdge::Right;
63+
default:
64+
fatalWithMessage("Invalid FlexDirection");
6365
}
64-
65-
fatalWithMessage("Invalid FlexDirection");
6666
}
6767

6868
inline PhysicalEdge flexEndEdge(FlexDirection flexDirection) {
@@ -75,9 +75,9 @@ inline PhysicalEdge flexEndEdge(FlexDirection flexDirection) {
7575
return PhysicalEdge::Right;
7676
case FlexDirection::RowReverse:
7777
return PhysicalEdge::Left;
78+
default:
79+
fatalWithMessage("Invalid FlexDirection");
7880
}
79-
80-
fatalWithMessage("Invalid FlexDirection");
8181
}
8282

8383
inline PhysicalEdge inlineStartEdge(
@@ -112,9 +112,9 @@ inline Dimension dimension(FlexDirection flexDirection) {
112112
return Dimension::Width;
113113
case FlexDirection::RowReverse:
114114
return Dimension::Width;
115+
default:
116+
fatalWithMessage("Invalid FlexDirection");
115117
}
116-
117-
fatalWithMessage("Invalid FlexDirection");
118118
}
119119

120120
} // namespace facebook::yoga

yoga/algorithm/SizingMode.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ inline MeasureMode measureMode(SizingMode mode) {
5252
return MeasureMode::Undefined;
5353
case SizingMode::FitContent:
5454
return MeasureMode::AtMost;
55+
default:
56+
fatalWithMessage("Invalid SizingMode");
5557
}
56-
57-
fatalWithMessage("Invalid SizingMode");
5858
}
5959

6060
inline SizingMode sizingMode(MeasureMode mode) {
@@ -65,9 +65,9 @@ inline SizingMode sizingMode(MeasureMode mode) {
6565
return SizingMode::MaxContent;
6666
case MeasureMode::AtMost:
6767
return SizingMode::FitContent;
68+
default:
69+
fatalWithMessage("Invalid MeasureMode");
6870
}
69-
70-
fatalWithMessage("Invalid MeasureMode");
7171
}
7272

7373
} // namespace facebook::yoga

yoga/style/Style.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -673,9 +673,9 @@ class YG_EXPORT Style {
673673
return computeRightEdge(position_, direction);
674674
case PhysicalEdge::Bottom:
675675
return computeBottomEdge(position_);
676+
default:
677+
fatalWithMessage("Invalid physical edge");
676678
}
677-
678-
fatalWithMessage("Invalid physical edge");
679679
}
680680

681681
Style::Length computeMargin(PhysicalEdge edge, Direction direction) const {
@@ -688,9 +688,9 @@ class YG_EXPORT Style {
688688
return computeRightEdge(margin_, direction);
689689
case PhysicalEdge::Bottom:
690690
return computeBottomEdge(margin_);
691+
default:
692+
fatalWithMessage("Invalid physical edge");
691693
}
692-
693-
fatalWithMessage("Invalid physical edge");
694694
}
695695

696696
Style::Length computePadding(PhysicalEdge edge, Direction direction) const {
@@ -703,9 +703,9 @@ class YG_EXPORT Style {
703703
return computeRightEdge(padding_, direction);
704704
case PhysicalEdge::Bottom:
705705
return computeBottomEdge(padding_);
706+
default:
707+
fatalWithMessage("Invalid physical edge");
706708
}
707-
708-
fatalWithMessage("Invalid physical edge");
709709
}
710710

711711
Style::Length computeBorder(PhysicalEdge edge, Direction direction) const {
@@ -718,9 +718,9 @@ class YG_EXPORT Style {
718718
return computeRightEdge(border_, direction);
719719
case PhysicalEdge::Bottom:
720720
return computeBottomEdge(border_);
721+
default:
722+
fatalWithMessage("Invalid physical edge");
721723
}
722-
723-
fatalWithMessage("Invalid physical edge");
724724
}
725725

726726
Direction direction_ : bitCount<Direction>() = Direction::Inherit;

0 commit comments

Comments
 (0)