diff options
author | Jack Lloyd <[email protected]> | 2017-01-22 14:46:07 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-01-22 14:46:07 -0500 |
commit | 8d75c5c95d80f994477da97ffc48fbbc754a4635 (patch) | |
tree | 76a1ec30a2850125e942218364409a348e38580e /src/lib/utils/cpuid.h | |
parent | ef8c214eb28abc36ddc4ffff467c51ed69cae63c (diff) |
Add CPUID::to_string
Deprecates CPUID::print, mainly to avoid use of ostream in utils.
Main reasoning is some platforms do not have streams at all. If all uses of
streams are for operator<< and operator>> overloads, these can be guarded by a
future BOTAN_HAS_CPP_STREAMS system-feature flag. But when ostreams are
required to use the API (as here), that is not possible.
Diffstat (limited to 'src/lib/utils/cpuid.h')
-rw-r--r-- | src/lib/utils/cpuid.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/lib/utils/cpuid.h b/src/lib/utils/cpuid.h index 2bb5a8301..98b5e14ce 100644 --- a/src/lib/utils/cpuid.h +++ b/src/lib/utils/cpuid.h @@ -9,6 +9,7 @@ #define BOTAN_CPUID_H__ #include <botan/types.h> +#include <string> #include <iosfwd> namespace Botan { @@ -41,7 +42,21 @@ class BOTAN_DLL CPUID static bool has_simd_32(); - static void print(std::ostream& o); + /** + * Deprecated equivalent to + * o << "CPUID flags: " << CPUID::to_string() << "\n"; + */ + static void BOTAN_DEPRECATED("Use CPUID::to_string") print(std::ostream& o); + + /** + * Return a possibly empty string containing list of known CPU + * extensions. Each name will be seperated by a space, and the ordering + * will be arbitrary. This list only contains values that are useful to + * Botan (for example FMA instructions are not checked). + * + * Example outputs "sse2 ssse3 rdtsc", "neon arm_aes", "altivec" + */ + static std::string to_string(); /** * Return a best guess of the cache line size |