generator: silence pedantic warnings for __int128
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
in fortuna, a use of 128bit integer is necessary, which also violates ISO C++: "warning: ISO C++ does not support ‘__int128’ for ‘ctr’ [-Wpedantic]" enclosing only the problematic blocks in ignore is chosen as a superior course of action, compared to completely removing "-Wpedantic" from CXX_FLAGS, as proposed in #2, as that would prevent any further "pedantic" warnings from any further code to be shown. this way, it is assured that the warning "ignore" is activated after push the push, after which the environment is returned back to its previous state with a pop, allowing any further warnings to appear. closes #2
This commit is contained in:
parent
c0012e36f9
commit
2f2f47da01
@ -19,7 +19,10 @@ namespace generator {
|
||||
|
||||
struct Generator::G_state{
|
||||
int64_t k;
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wpedantic"
|
||||
unsigned __int128 ctr;
|
||||
#pragma GCC diagnostic pop
|
||||
};
|
||||
|
||||
void Generator::initialize_generator(){
|
||||
@ -84,6 +87,8 @@ auto Generator::do_sha(const std::string& k_n_s) -> std::string {
|
||||
return "42";
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wpedantic"
|
||||
auto Generator::do_crypto(int64_t k, unsigned __int128 ctr) -> std::string {
|
||||
/* this function calls the block cipher
|
||||
* returns a string of k*(16 bytes);
|
||||
@ -92,6 +97,7 @@ auto Generator::do_crypto(int64_t k, unsigned __int128 ctr) -> std::string {
|
||||
ctr = 0;
|
||||
return "";
|
||||
}
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
auto Generator::generate_blocks(unsigned int k_blocks) -> std::string {
|
||||
G_state G = get_state();
|
||||
|
@ -18,7 +18,10 @@ private:
|
||||
|
||||
auto do_sha(const std::string& k_n_s) -> std::string;
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wpedantic"
|
||||
auto do_crypto(int64_t k, unsigned __int128 ctr) -> std::string;
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
/* n is the number of random bytes to generate */
|
||||
auto generate_random_data(uint n) -> std::string;
|
||||
|
Reference in New Issue
Block a user