xref: /netbsd-src/external/gpl3/gdb/dist/libdecnumber/decExcept.c (revision 4559860ef23039476746699b4757c1b6983b488b)
14e98e3e1Schristos /* Temporary library support for decimal floating point.
2*4559860eSchristos    Copyright (C) 2005-2018 Free Software Foundation, Inc.
34e98e3e1Schristos 
44e98e3e1Schristos    This file is part of GCC.
54e98e3e1Schristos 
64e98e3e1Schristos    GCC is free software; you can redistribute it and/or modify it
74e98e3e1Schristos    under the terms of the GNU General Public License as published by
84e98e3e1Schristos    the Free Software Foundation; either version 3, or (at your option)
94e98e3e1Schristos    any later version.
104e98e3e1Schristos 
114e98e3e1Schristos    GCC is distributed in the hope that it will be useful, but WITHOUT
124e98e3e1Schristos    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
134e98e3e1Schristos    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
144e98e3e1Schristos    License for more details.
154e98e3e1Schristos 
164e98e3e1Schristos Under Section 7 of GPL version 3, you are granted additional
174e98e3e1Schristos permissions described in the GCC Runtime Library Exception, version
184e98e3e1Schristos 3.1, as published by the Free Software Foundation.
194e98e3e1Schristos 
204e98e3e1Schristos You should have received a copy of the GNU General Public License and
214e98e3e1Schristos a copy of the GCC Runtime Library Exception along with this program;
224e98e3e1Schristos see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
234e98e3e1Schristos <http://www.gnu.org/licenses/>.  */
244e98e3e1Schristos 
254e98e3e1Schristos #include <fenv.h>
264e98e3e1Schristos #include "dconfig.h"
274e98e3e1Schristos #include "decContext.h"
284e98e3e1Schristos #include "decExcept.h"
294e98e3e1Schristos 
304e98e3e1Schristos /* Internal, non-documented functions for testing libgcc functions.
314e98e3e1Schristos    This support is not sufficient for real use.  */
324e98e3e1Schristos 
334e98e3e1Schristos static int __dfp_except_flags = 0;
344e98e3e1Schristos 
354e98e3e1Schristos /* Clear the dummy exception flags.  */
364e98e3e1Schristos void
__dfp_clear_except(void)374e98e3e1Schristos __dfp_clear_except (void)
384e98e3e1Schristos {
394e98e3e1Schristos   __dfp_except_flags = 0;
404e98e3e1Schristos }
414e98e3e1Schristos 
424e98e3e1Schristos /* Return the dummy exception flags corresponding to the mask.  */
434e98e3e1Schristos int
__dfp_test_except(int mask)444e98e3e1Schristos __dfp_test_except (int mask)
454e98e3e1Schristos {
464e98e3e1Schristos   return __dfp_except_flags & mask;
474e98e3e1Schristos }
484e98e3e1Schristos 
494e98e3e1Schristos /* Set dummy exception flags.  */
504e98e3e1Schristos void
__dfp_raise_except(int flags)514e98e3e1Schristos __dfp_raise_except (int flags)
524e98e3e1Schristos {
534e98e3e1Schristos   __dfp_except_flags |= flags;
544e98e3e1Schristos }
55