mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
Allow to build with -Werror and clang
Fixes -Wdeprecated-enum-enum-conversion, -Wdeprecated-declarations, -Wrange-loop-construct, -Winconsistent-missing-override
This commit is contained in:
parent
89765340c3
commit
b6881022ce
9 changed files with 21 additions and 13 deletions
|
@ -292,7 +292,7 @@ ChatRestrictions FixDependentRestrictions(ChatRestrictions restrictions) {
|
|||
|
||||
// Apply the strictest.
|
||||
const auto fixOne = [&] {
|
||||
for (const auto [first, second] : dependencies) {
|
||||
for (const auto &[first, second] : dependencies) {
|
||||
if ((restrictions & second) && !(restrictions & first)) {
|
||||
restrictions |= first;
|
||||
return true;
|
||||
|
|
|
@ -126,7 +126,7 @@ PreLaunchLog::PreLaunchLog(QWidget *parent) : QTextEdit(parent) {
|
|||
setPalette(p);
|
||||
|
||||
setReadOnly(true);
|
||||
setFrameStyle(QFrame::NoFrame | QFrame::Plain);
|
||||
setFrameStyle(int(QFrame::NoFrame) | QFrame::Plain);
|
||||
viewport()->setAutoFillBackground(false);
|
||||
setContentsMargins(0, 0, 0, 0);
|
||||
document()->setDocumentMargin(0);
|
||||
|
|
|
@ -127,11 +127,11 @@ ButtonBar::ButtonBar(
|
|||
if (children.empty()) {
|
||||
return;
|
||||
}
|
||||
const auto widgets = ranges::view::all(
|
||||
const auto widgets = ranges::views::all(
|
||||
children
|
||||
) | ranges::view::filter([](not_null<const QObject*> object) {
|
||||
) | ranges::views::filter([](not_null<const QObject*> object) {
|
||||
return object->isWidgetType();
|
||||
}) | ranges::view::transform([](not_null<QObject*> object) {
|
||||
}) | ranges::views::transform([](not_null<QObject*> object) {
|
||||
return static_cast<Ui::RpWidget*>(object.get());
|
||||
}) | ranges::to_vector;
|
||||
|
||||
|
|
|
@ -2678,7 +2678,7 @@ MessageIdsList HistoryInner::getSelectedItems() const {
|
|||
return selected.first->fullId();
|
||||
}) | to_vector;
|
||||
|
||||
result |= actions::sort(ordered_less{}, [](const FullMsgId &msgId) {
|
||||
result |= actions::sort(less{}, [](const FullMsgId &msgId) {
|
||||
return msgId.channel ? msgId.msg : (msgId.msg - ServerMaxMsgId);
|
||||
});
|
||||
return result;
|
||||
|
|
|
@ -136,7 +136,7 @@ int paintBubbleSide(
|
|||
CornerVerticalSide side,
|
||||
const style::color &bg) {
|
||||
if (style == SideStyle::Rounded) {
|
||||
const auto corner = (NormalMask * MaskMultiplier) | side;
|
||||
const auto corner = (int(NormalMask) * MaskMultiplier) | side;
|
||||
auto left = circleCorner(corner | CornerLeft, bg);
|
||||
int leftWidth = left.width() / cIntRetinaFactor();
|
||||
p.drawPixmap(x, y, left);
|
||||
|
@ -155,7 +155,7 @@ int paintBubbleSide(
|
|||
return cornerHeight;
|
||||
} else if (style == SideStyle::Inverted) {
|
||||
// CornerLeft and CornerRight are inverted for SideStyle::Inverted sprites.
|
||||
const auto corner = (InvertedMask * MaskMultiplier) | side;
|
||||
const auto corner = (int(InvertedMask) * MaskMultiplier) | side;
|
||||
auto left = circleCorner(corner | CornerRight, bg);
|
||||
int leftWidth = left.width() / cIntRetinaFactor();
|
||||
p.drawPixmap(x - leftWidth, y, left);
|
||||
|
|
|
@ -512,7 +512,7 @@ void OverlayWidget::RendererGL::validateControls() {
|
|||
};
|
||||
auto maxWidth = 0;
|
||||
auto fullHeight = 0;
|
||||
for (const auto meta : metas) {
|
||||
for (const auto &meta : metas) {
|
||||
maxWidth = std::max(meta.icon->width(), maxWidth);
|
||||
fullHeight += meta.icon->height();
|
||||
}
|
||||
|
@ -525,7 +525,7 @@ void OverlayWidget::RendererGL::validateControls() {
|
|||
auto p = QPainter(&image);
|
||||
auto index = 0;
|
||||
auto height = 0;
|
||||
for (const auto meta : metas) {
|
||||
for (const auto &meta : metas) {
|
||||
meta.icon->paint(p, 0, height, maxWidth);
|
||||
_controlsTextures[index++] = QRect(
|
||||
QPoint(0, height) * _factor,
|
||||
|
|
|
@ -636,7 +636,7 @@ void Pip::RendererGL::validateControls() {
|
|||
};
|
||||
auto maxWidth = 0;
|
||||
auto fullHeight = 0;
|
||||
for (const auto meta : metas) {
|
||||
for (const auto &meta : metas) {
|
||||
Assert(meta.icon->size() == meta.iconOver->size());
|
||||
maxWidth = std::max(meta.icon->width(), maxWidth);
|
||||
fullHeight += 2 * meta.icon->height();
|
||||
|
@ -657,7 +657,7 @@ void Pip::RendererGL::validateControls() {
|
|||
icon->size() * _factor);
|
||||
height += icon->height();
|
||||
};
|
||||
for (const auto meta : metas) {
|
||||
for (const auto &meta : metas) {
|
||||
paint(meta.icon);
|
||||
paint(meta.iconOver);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ class Launcher : public Core::Launcher {
|
|||
public:
|
||||
Launcher(int argc, char *argv[]);
|
||||
|
||||
int exec();
|
||||
int exec() override;
|
||||
|
||||
private:
|
||||
void initHook() override;
|
||||
|
|
|
@ -211,6 +211,14 @@ elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
|||
)
|
||||
endif()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
target_compile_options(lib_tgcalls
|
||||
PRIVATE
|
||||
-Wno-deprecated-volatile
|
||||
-Wno-ambiguous-reversed-operator
|
||||
)
|
||||
endif()
|
||||
|
||||
remove_target_sources(lib_tgcalls ${tgcalls_loc}
|
||||
platform/android/AndroidContext.cpp
|
||||
platform/android/AndroidContext.h
|
||||
|
|
Loading…
Add table
Reference in a new issue