mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-15 19:02:04 +00:00
0f6715bd91
In PR #37300, Alexej asked why we the compiler does not warn about unnecessary semicolons, e.g. f() { }; // <-- here The answer is surprising: In C++98, above syntax was disallowed but by most compilers accepted it regardless. C++>11 introduced "empty declarations" which made the syntax legal. The previous behavior can be restored using flag -Wc++98-compat-extra-semi. This finds many useless semicolons which were removed in this change. Unfortunately, there are also false positives which would require #pragma-s and HAS_* logic (--> check_flags.cmake) to suppress. In the end, -Wc++98-compat-extra-semi comes with extra effort for little benefit. Therefore, this change only fixes some semicolons but does not enable the flag.
43 lines
919 B
C++
43 lines
919 B
C++
#include "ExecutableSettings.h"
|
|
|
|
#include <Common/Exception.h>
|
|
|
|
#include <Parsers/ASTCreateQuery.h>
|
|
#include <Parsers/ASTSetQuery.h>
|
|
#include <Parsers/ASTFunction.h>
|
|
|
|
namespace DB
|
|
{
|
|
|
|
namespace ErrorCodes
|
|
{
|
|
extern const int UNKNOWN_SETTING;
|
|
}
|
|
|
|
IMPLEMENT_SETTINGS_TRAITS(ExecutableSettingsTraits, LIST_OF_EXECUTABLE_SETTINGS)
|
|
|
|
void ExecutableSettings::loadFromQuery(ASTStorage & storage_def)
|
|
{
|
|
if (storage_def.settings)
|
|
{
|
|
try
|
|
{
|
|
applyChanges(storage_def.settings->changes);
|
|
}
|
|
catch (Exception & e)
|
|
{
|
|
if (e.code() == ErrorCodes::UNKNOWN_SETTING)
|
|
e.addMessage("for storage " + storage_def.engine->name);
|
|
throw;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
auto settings_ast = std::make_shared<ASTSetQuery>();
|
|
settings_ast->is_standalone = false;
|
|
storage_def.set(storage_def.settings, settings_ast);
|
|
}
|
|
}
|
|
|
|
}
|