update(engine): remove banned.h

Signed-off-by: Luca Guerra <luca@guerra.sh>
This commit is contained in:
Luca Guerra 2023-10-19 07:36:14 +00:00 committed by poiana
parent b7cef5bab2
commit 1e38967b18
21 changed files with 0 additions and 69 deletions

View File

@ -1,48 +0,0 @@
// SPDX-License-Identifier: Apache-2.0
/*
Copyright (C) 2023 The Falco Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#pragma once
// BAN macro defines `function` as an invalid token that says using
// the function is banned. This throws a compile time error when the
// function is used.
#define BAN(function) using_##function##_is_banned
// BAN_ALTERNATIVE is same as BAN but the message also provides an alternative
// function that the user could use instead of the banned function.
#define BAN_ALTERNATIVE(function, alternative) using_##function##_is_banned__use_##alternative##_instead
#undef strcpy
#define strcpy(a, b) BAN(strcpy)
#undef vsprintf
#define vsprintf(a, b, c) BAN_ALTERNATIVE(vsprintf, vsnprintf)
#undef sprintf
#define sprintf(a, b, ...) BAN_ALTERNATIVE(sprintf, snprintf)
#undef strcat
#define strcat(a, b) BAN(strcat)
#undef strncpy
#define strncpy(a, b, c) BAN(strncpy)
#undef swprintf
#define swprintf(a, b, c, ...) BAN_ALTERNATIVE(swprintf, snprintf)
#undef vswprintf
#define vswprintf(a, b, c, d) BAN_ALTERNATIVE(vswprintf, vsnprintf)

View File

@ -16,7 +16,6 @@ limitations under the License.
*/
#include "evttype_index_ruleset.h"
#include "banned.h" // This raises a compilation error when certain functions are used
#include <algorithm>

View File

@ -44,7 +44,6 @@ limitations under the License.
#include "formats.h"
#include "utils.h"
#include "banned.h" // This raises a compilation error when certain functions are used
#include "evttype_index_ruleset.h"
const std::string falco_engine::s_default_ruleset = "falco-default-ruleset";

View File

@ -22,7 +22,6 @@ limitations under the License.
#include "falco_utils.h"
#include "utils.h"
#include "banned.h" // This raises a compilation error when certain functions are used
#include <re2/re2.h>

View File

@ -19,7 +19,6 @@ limitations under the License.
#include "formats.h"
#include "falco_engine.h"
#include "banned.h" // This raises a compilation error when certain functions are used
falco_formats::falco_formats(std::shared_ptr<const falco_engine> engine,
bool json_include_output_property,

View File

@ -22,7 +22,6 @@ limitations under the License.
#include "falco_common.h"
#include "json_evt.h"
#include "banned.h" // This raises a compilation error when certain functions are used
using json = nlohmann::json;
using namespace std;

View File

@ -30,7 +30,6 @@ limitations under the License.
#include "configuration.h"
#include "logger.h"
#include "banned.h" // This raises a compilation error when certain functions are used
falco_configuration::falco_configuration():
m_json_output(false),

View File

@ -17,7 +17,6 @@ limitations under the License.
#include "event_drops.h"
#include "falco_common.h"
#include "banned.h" // This raises a compilation error when certain functions are used
syscall_evt_drop_mgr::syscall_evt_drop_mgr():
m_num_syscall_evt_drops(0),

View File

@ -22,7 +22,6 @@ limitations under the License.
#include "app/app.h"
#include "logger.h"
#include "banned.h" // This raises a compilation error when certain functions are used
static void display_fatal_err(const std::string &&msg)
{

View File

@ -35,8 +35,6 @@ limitations under the License.
#include "outputs_grpc.h"
#endif
#include "banned.h" // This raises a compilation error when certain functions are used
static const char* s_internal_source = "internal";
falco_outputs::falco_outputs(

View File

@ -18,7 +18,6 @@ limitations under the License.
#include <sstream>
#include "grpc_context.h"
#include "banned.h" // This raises a compilation error when certain functions are used
falco::grpc::context::context(::grpc::ServerContext* ctx):
m_ctx(ctx)

View File

@ -25,7 +25,6 @@ limitations under the License.
#include "grpc_server.h"
#include "grpc_request_context.h"
#include "falco_utils.h"
#include "banned.h" // This raises a compilation error when certain functions are used
#define REGISTER_STREAM(req, res, svc, rpc, impl, num) \
std::vector<request_stream_context<svc, req, res>> rpc##_contexts(num); \

View File

@ -21,7 +21,6 @@ limitations under the License.
#include "grpc_server_impl.h"
#include "grpc_queue.h"
#include "logger.h"
#include "banned.h" // This raises a compilation error when certain functions are used
bool falco::grpc::server_impl::is_running()
{

View File

@ -19,7 +19,6 @@ limitations under the License.
#include "logger.h"
#include "falco_common.h"
#include "banned.h" // This raises a compilation error when certain functions are used
int falco_logger::level = LOG_INFO;
bool falco_logger::time_format_iso_8601 = false;

View File

@ -18,7 +18,6 @@ limitations under the License.
#include "outputs_file.h"
#include <iostream>
#include <fstream>
#include "banned.h" // This raises a compilation error when certain functions are used
void falco::outputs::output_file::open_file()
{

View File

@ -20,7 +20,6 @@ limitations under the License.
#include "grpc_queue.h"
#include "falco_common.h"
#include "formats.h"
#include "banned.h" // This raises a compilation error when certain functions are used
#if __has_attribute(deprecated)
#define DISABLE_WARNING_PUSH _Pragma("GCC diagnostic push")

View File

@ -17,7 +17,6 @@ limitations under the License.
#include "outputs_http.h"
#include "logger.h"
#include "banned.h" // This raises a compilation error when certain functions are used
#define CHECK_RES(fn) res = res == CURLE_OK ? fn : res

View File

@ -17,7 +17,6 @@ limitations under the License.
#include "outputs_program.h"
#include <stdio.h>
#include "banned.h" // This raises a compilation error when certain functions are used
void falco::outputs::output_program::open_pfile()
{

View File

@ -17,7 +17,6 @@ limitations under the License.
#include "outputs_stdout.h"
#include <iostream>
#include "banned.h" // This raises a compilation error when certain functions are used
void falco::outputs::output_stdout::output(const message *msg)
{

View File

@ -17,7 +17,6 @@ limitations under the License.
#include "outputs_syslog.h"
#include <syslog.h>
#include "banned.h" // This raises a compilation error when certain functions are used
void falco::outputs::output_syslog::output(const message *msg)
{

View File

@ -26,7 +26,6 @@ limitations under the License.
#include "falco_common.h"
#include "stats_writer.h"
#include "logger.h"
#include "banned.h" // This raises a compilation error when certain functions are used
#include "config_falco.h"
// note: ticker_t is an uint16_t, which is enough because we don't care about