From 742e07391d2c118583bc533395e98c4a5ff7d9f4 Mon Sep 17 00:00:00 2001 From: Yuanjie Huang Date: Wed, 27 Feb 2019 15:32:16 +0800 Subject: [PATCH] Print clear message when mis-used in synthesis This closes #3. --- include/ap_common.h | 14 +++++++------- include/ap_fixed_base.h | 4 +--- include/ap_fixed_ref.h | 4 +--- include/ap_fixed_special.h | 5 +++++ include/ap_int_base.h | 4 +--- include/ap_int_ref.h | 4 +--- include/ap_int_special.h | 5 +++++ 7 files changed, 21 insertions(+), 19 deletions(-) diff --git a/include/ap_common.h b/include/ap_common.h index 8a53924..4d2886c 100644 --- a/include/ap_common.h +++ b/include/ap_common.h @@ -22,10 +22,12 @@ // Forward declaration of all AP types. #include -// Automatically enable half if FPO exists -#if ! defined _AP_ENABLE_HALF_ && defined __SIM_FPO__ -#define _AP_ENABLE_HALF_ 1 -#endif + +#ifdef __SYNTHESIS__ +#error "The open-source version of AP types does not support synthesis." +#endif // ifdef __SYNTHESIS__ +#define _AP_ENABLE_HALF_ 0 + #if _AP_ENABLE_HALF_ == 1 // Before ap_private definition. @@ -191,9 +193,7 @@ struct remove_const<_Tp const> { // ---------------------------------------------------------------------- // Define ssdm_int and _ssdm_op. -#ifdef __SYNTHESIS__ -#error "This header does not sypport synthesis" -#endif // ifdef __SYNTHESIS__ +// XXX deleted in open-source version #ifndef NON_C99STRING #define _AP_C99 true diff --git a/include/ap_fixed_base.h b/include/ap_fixed_base.h index 5427f77..1d94b93 100644 --- a/include/ap_fixed_base.h +++ b/include/ap_fixed_base.h @@ -18,9 +18,7 @@ #define __AP_FIXED_BASE_H__ #ifndef __AP_FIXED_H__ -// TODO make this an error -#pragma message \ - "Only ap_fixed.h and ap_int.h can be included directly in user code." +#error "Only ap_fixed.h and ap_int.h can be included directly in user code." #endif // for ap_int_base and its reference types. diff --git a/include/ap_fixed_ref.h b/include/ap_fixed_ref.h index 0fe5220..aefda0a 100644 --- a/include/ap_fixed_ref.h +++ b/include/ap_fixed_ref.h @@ -18,9 +18,7 @@ #define __AP_FIXED_REF_H__ #ifndef __AP_FIXED_H__ -// TODO make this an error -#pragma message \ - "Only ap_fixed.h and ap_int.h can be included directly in user code." +#error "Only ap_fixed.h and ap_int.h can be included directly in user code." #endif #ifndef __cplusplus diff --git a/include/ap_fixed_special.h b/include/ap_fixed_special.h index 4484d44..0f7a9f7 100644 --- a/include/ap_fixed_special.h +++ b/include/ap_fixed_special.h @@ -16,6 +16,11 @@ #ifndef __AP_FIXED_SPECIAL_H__ #define __AP_FIXED_SPECIAL_H__ + +#ifndef __AP_FIXED_H__ +#error "Only ap_fixed.h and ap_int.h can be included directly in user code." +#endif + #ifndef __SYNTHESIS__ #include #include diff --git a/include/ap_int_base.h b/include/ap_int_base.h index f801585..091552a 100644 --- a/include/ap_int_base.h +++ b/include/ap_int_base.h @@ -18,9 +18,7 @@ #define __AP_INT_BASE_H__ #ifndef __AP_INT_H__ -// TODO make this an error -#pragma message \ - "Only ap_fixed.h and ap_int.h can be included directly in user code." +#error "Only ap_fixed.h and ap_int.h can be included directly in user code." #endif #ifndef __cplusplus diff --git a/include/ap_int_ref.h b/include/ap_int_ref.h index a9b24ee..421f09f 100644 --- a/include/ap_int_ref.h +++ b/include/ap_int_ref.h @@ -18,9 +18,7 @@ #define __AP_INT_REF_H__ #ifndef __AP_INT_H__ -// TODO make this an error -#pragma message \ - "Only ap_fixed.h and ap_int.h can be included directly in user code." +#error "Only ap_fixed.h and ap_int.h can be included directly in user code." #endif #ifndef __cplusplus diff --git a/include/ap_int_special.h b/include/ap_int_special.h index e45f3d0..3afc619 100644 --- a/include/ap_int_special.h +++ b/include/ap_int_special.h @@ -16,6 +16,11 @@ #ifndef __AP_INT_SPECIAL_H__ #define __AP_INT_SPECIAL_H__ + +#ifndef __AP_INT_H__ +#error "Only ap_fixed.h and ap_int.h can be included directly in user code." +#endif + #ifndef __SYNTHESIS__ #include #include