hashlib: only include in one place

This commit is contained in:
Emil J. Tywoniak 2024-10-15 12:00:51 +02:00
parent db04788c18
commit c73c88033d
3 changed files with 3 additions and 3 deletions

View File

@ -34,6 +34,8 @@ namespace hashlib {
* Hashlib doesn't know how to hash silly Yosys-specific types. * Hashlib doesn't know how to hash silly Yosys-specific types.
* Hashlib doesn't depend on Yosys and can be used standalone. * Hashlib doesn't depend on Yosys and can be used standalone.
* Please don't use hashlib standalone for new projects. * Please don't use hashlib standalone for new projects.
* Never directly include kernel/hashlib.h in Yosys code.
* Instead include kernel/yosys_common.h
* *
* The hash_ops type is now always left to its default value, derived * The hash_ops type is now always left to its default value, derived
* from templated functions through SFINAE. Providing custom ops is * from templated functions through SFINAE. Providing custom ops is

View File

@ -134,8 +134,7 @@ YOSYS_NAMESPACE_BEGIN
// Note: All headers included in hashlib.h must be included // Note: All headers included in hashlib.h must be included
// outside of YOSYS_NAMESPACE before this or bad things will happen. // outside of YOSYS_NAMESPACE before this or bad things will happen.
#ifdef HASHLIB_H #ifdef HASHLIB_H
# undef HASHLIB_H # error You've probably included hashlib.h under two namespace paths. Bad idea.
# include "kernel/hashlib.h"
#else #else
# include "kernel/hashlib.h" # include "kernel/hashlib.h"
# undef HASHLIB_H # undef HASHLIB_H

View File

@ -20,7 +20,6 @@
#include "kernel/register.h" #include "kernel/register.h"
#include "kernel/rtlil.h" #include "kernel/rtlil.h"
#include "kernel/log.h" #include "kernel/log.h"
#include "kernel/hashlib.h"
USING_YOSYS_NAMESPACE USING_YOSYS_NAMESPACE
PRIVATE_NAMESPACE_BEGIN PRIVATE_NAMESPACE_BEGIN