Skip to content

Commit

Permalink
Fix Build warning C4068 for MSVC (#221)
Browse files Browse the repository at this point in the history
- GCC pragma is not a valid pragma in MSVC, thus produces warning C4068:
unknown pragma 'GCC'.
- The workaround is to encapsulate the GCC pragma in if GNUC defined
block.

Signed-off-by: Avinal Kumar <avinal.xlvii@gmail.com>
  • Loading branch information
avinal authored Oct 22, 2021
1 parent 5daa853 commit a29c8b4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/electionguard/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,16 @@ namespace electionguard
{
auto now = system_clock::now();
auto ticks = now.time_since_epoch();

#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-conversion"
#endif // __GNUC__
return ticks.count() * system_clock::period::num / system_clock::period::den;
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif // __GNUC__

}

/// <Summary>
Expand Down

0 comments on commit a29c8b4

Please sign in to comment.