obs-browser: Fix compiler warnings #327

Merged
cg2121 merged 1 commit from fix-browser-warnings into master 2021-11-19 21:27:55 -06:00
cg2121 commented 2021-11-03 13:38:38 -05:00 (Migrated from github.com)

Description

This fixes warnings found with GCC on Linux.

Motivation and Context

Warnings are annoying.

How Has This Been Tested?

Compiled to see if warnings went away.

Types of changes

  • Code cleanup (non-breaking change which makes code smaller or more readable)

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.
### Description This fixes warnings found with GCC on Linux. ### Motivation and Context Warnings are annoying. ### How Has This Been Tested? Compiled to see if warnings went away. ### Types of changes - Code cleanup (non-breaking change which makes code smaller or more readable) ### Checklist: - [x] My code has been run through [clang-format](https://github.com/obsproject/obs-studio/blob/master/.clang-format). - [x] I have read the [**contributing** document](https://github.com/obsproject/obs-studio/blob/master/CONTRIBUTING.rst). - [x] My code is not on the master branch. - [x] The code has been tested. - [x] All commit messages are properly formatted and commits squashed where appropriate. - [x] I have included updates to all appropriate documentation.
sebastian-s-beckmann (Migrated from github.com) requested changes 2021-11-03 13:44:16 -05:00
sebastian-s-beckmann (Migrated from github.com) left a comment

This is a bad idea, that switch is meant to fall through (otherwise for example having Full access wouldn't give you access to Advanced and below).
However, this PR does prove RytoEX's point about the switch not being particularly beautiful. Feel free to refactor it.

This is a bad idea, that switch is meant to fall through (otherwise for example having `Full` access wouldn't give you access to `Advanced` and below). However, this PR does prove RytoEX's point about the switch not being particularly beautiful. Feel free to refactor it.
WizardCM commented 2021-11-03 16:25:44 -05:00 (Migrated from github.com)

Yeah my understanding was that this is intentional.

Yeah my understanding was that this is intentional.
RytoEX commented 2021-11-04 13:39:40 -05:00 (Migrated from github.com)

This is a bad idea, that switch is meant to fall through (otherwise for example having Full access wouldn't give you access to Advanced and below). However, this PR does prove RytoEX's point about the switch not being particularly beautiful. Feel free to refactor it.

To avoid compiler warnings, wouldn't [[fallthrough]] from C++17 be more appropriate?

Supported in:

  • GCC 7
  • Clang 3.9
  • MSVC since 16.10 (VS 2017 15.0)

https://en.cppreference.com/w/cpp/language/attributes/fallthrough

> > > This is a bad idea, that switch is meant to fall through (otherwise for example having `Full` access wouldn't give you access to `Advanced` and below). However, this PR does prove RytoEX's point about the switch not being particularly beautiful. Feel free to refactor it. To avoid compiler warnings, wouldn't `[[fallthrough]]` from C++17 be more appropriate? Supported in: * GCC 7 * Clang 3.9 * MSVC since 16.10 (VS 2017 15.0) https://en.cppreference.com/w/cpp/language/attributes/fallthrough
cg2121 commented 2021-11-15 19:54:03 -06:00 (Migrated from github.com)

Updated it to use the fallthrough statements

Updated it to use the [[fallthrough]] statements
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-obsproject/obs-browser!327
No description provided.