Skip to content

Commit

Permalink
Code review snippets to address from @davidben
Browse files Browse the repository at this point in the history
Also:
* sus_if_msvc for attributes should be sus_if_msvc_not_cl
  * "language is msvc variant" vs "compiler is msvc"
  * sus_if_gnuc_language
* test wrapping for each integer size, esp < 32bit
* not destroy nevervalue? since it's in a union can that be a
  requirement on NeverValueTypes, and is C++ okay with constructing
  an object in a place where one already exists and was not destroyed?
  • Loading branch information
danakj committed Oct 13, 2023
1 parent 7147b8f commit 2c4c226
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 93 deletions.
1 change: 0 additions & 1 deletion sus/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ target_sources(subspace PUBLIC
"iter/zip.h"
"macros/__private/compiler_bugs.h"
"macros/assume.h"
"macros/arch.h"
"macros/builtin.h"
"macros/compiler.h"
"macros/eval_macro.h"
Expand Down
23 changes: 0 additions & 23 deletions sus/macros/arch.h

This file was deleted.

4 changes: 2 additions & 2 deletions sus/macros/pure.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
///
/// A pure function is allowed to dereference pointers, and access global
/// memory, but it may not change them. To do so can cause Undefined Behaviour.
#define sus_pure sus_if_msvc_else([[nodiscard]], __attribute__((pure)))
#define sus_pure [[nodiscard]] sus_if_not_msvc_compiler(, __attribute__((pure)))

/// Used to mark a function as "const", meaning it does not change any values
/// outside of its own scope, and does not read global memory.
Expand All @@ -31,4 +31,4 @@
/// A const function is allowed to only read from its inputs and determine an
/// output from them, without going through pointers or accessing global memory.
/// To do so anyway can cause Undefined Behaviour.
#define sus_pure_const sus_if_msvc_else([[nodiscard]], __attribute__((const)))
#define sus_pure_const [[nodiscard]] sus_if_msvc_else(, __attribute__((const)))
Loading

0 comments on commit 2c4c226

Please sign in to comment.