macros: Always emit f16_enabled and f128_enabled attributes

Once we start addinf `f16` and `f128` routines, we will need to have
this cfg for almost all uses of `for_each_function`. Rather than needing
to specify this each time, always emit `#[cfg(f16_enabled)]` or
`#[cfg(f128_enabled)]` for each function that uses `f16` or `f128`,
respectively.
This commit is contained in:
Trevor Gross
2025-01-02 21:23:28 +00:00
committed by Trevor Gross
parent d39169556a
commit 3fb16fbdbe
9 changed files with 57 additions and 20 deletions

View File

@@ -1,3 +1,5 @@
#![cfg_attr(f16_enabled, feature(f16))]
#![cfg_attr(f128_enabled, feature(f128))]
#![allow(clippy::unusual_byte_groupings)] // sometimes we group by sign_exp_sig
pub mod domain;

View File

@@ -50,9 +50,11 @@ macro_rules! impl_mp_op {
(
fn_name: $fn_name:ident,
RustFn: fn($_fty:ty,) -> $_ret:ty,
attrs: [$($attr:meta),*],
fn_extra: $fn_name_normalized:expr,
) => {
paste::paste! {
$(#[$attr])*
impl MpOp for crate::op::$fn_name::Routine {
type MpTy = MpFloat;
@@ -72,9 +74,11 @@ macro_rules! impl_mp_op {
(
fn_name: $fn_name:ident,
RustFn: fn($_fty:ty, $_fty2:ty,) -> $_ret:ty,
attrs: [$($attr:meta),*],
fn_extra: $fn_name_normalized:expr,
) => {
paste::paste! {
$(#[$attr])*
impl MpOp for crate::op::$fn_name::Routine {
type MpTy = (MpFloat, MpFloat);
@@ -95,9 +99,11 @@ macro_rules! impl_mp_op {
(
fn_name: $fn_name:ident,
RustFn: fn($_fty:ty, $_fty2:ty, $_fty3:ty,) -> $_ret:ty,
attrs: [$($attr:meta),*],
fn_extra: $fn_name_normalized:expr,
) => {
paste::paste! {
$(#[$attr])*
impl MpOp for crate::op::$fn_name::Routine {
type MpTy = (MpFloat, MpFloat, MpFloat);

View File

@@ -112,8 +112,11 @@ macro_rules! do_thing {
RustFn: $RustFn:ty,
RustArgs: $RustArgs:ty,
RustRet: $RustRet:ty,
attrs: [$($attr:meta),*],
) => {
paste::paste! {
$(#[$attr])*
pub mod $fn_name {
use super::*;
pub struct Routine;