[commit: ghc] master: includes/Stg.h: add declarations for hs_popcnt and frinds (858a807)

git at git.haskell.org git at git.haskell.org
Mon Feb 17 07:48:49 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/858a807d5522145e8ede9148a15bb65a0d851c00/ghc

>---------------------------------------------------------------

commit 858a807d5522145e8ede9148a15bb65a0d851c00
Author: Sergei Trofimovich <slyfox at gentoo.org>
Date:   Thu Feb 13 07:27:46 2014 -0600

    includes/Stg.h: add declarations for hs_popcnt and frinds
    
    This fixes most of implicit function declarations emitted
    C codegen in UNREG mode. Found by adding the following to
    mk/build.mk:
    
        SRC_CC_OPTS += -Werror=implicit-function-declaration
        SRC_HC_OPTS += -optc-Werror=implicit-function-declaration
    
    Issue #8748
    
    Signed-off-by: Sergei Trofimovich <slyfox at gentoo.org>
    Signed-off-by: Austin Seipp <austin at well-typed.com>


>---------------------------------------------------------------

858a807d5522145e8ede9148a15bb65a0d851c00
 includes/Stg.h      |    1 +
 includes/stg/Prim.h |   39 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/includes/Stg.h b/includes/Stg.h
index 09de8d4..be966aa 100644
--- a/includes/Stg.h
+++ b/includes/Stg.h
@@ -240,6 +240,7 @@ typedef StgFunPtr       F_;
 #include "stg/MiscClosures.h"
 #endif
 
+#include "stg/Prim.h" /* ghc-prim fallbacks */
 #include "stg/SMP.h" // write_barrier() inline is required
 
 /* -----------------------------------------------------------------------------
diff --git a/includes/stg/Prim.h b/includes/stg/Prim.h
new file mode 100644
index 0000000..2b23c3d
--- /dev/null
+++ b/includes/stg/Prim.h
@@ -0,0 +1,39 @@
+/* ----------------------------------------------------------------------------
+ *
+ * (c) The GHC Team, 2014-2014
+ *
+ * Declarations for C fallback primitives implemented by 'ghc-prim' package.
+ *
+ * Do not #include this file directly: #include "Rts.h" instead.
+ *
+ * To understand the structure of the RTS headers, see the wiki:
+ *   http://ghc.haskell.org/trac/ghc/wiki/Commentary/SourceTree/Includes
+ *
+ * -------------------------------------------------------------------------- */
+
+#ifndef PRIM_H
+#define PRIM_H
+
+/* libraries/ghc-prim/cbits/bswap.c */
+StgWord16 hs_bswap16(StgWord16 x);
+StgWord32 hs_bswap32(StgWord32 x);
+StgWord64 hs_bswap64(StgWord64 x);
+
+/* TODO: longlong.c */
+
+/* libraries/ghc-prim/cbits/popcnt.c */
+StgWord hs_popcnt8(StgWord8 x);
+StgWord hs_popcnt16(StgWord16 x);
+StgWord hs_popcnt32(StgWord32 x);
+StgWord hs_popcnt64(StgWord64 x);
+#ifdef i386_HOST_ARCH
+StgWord hs_popcnt(StgWord32 x);
+#else
+StgWord hs_popcnt(StgWord64 x);
+#endif
+
+/* libraries/ghc-prim/cbits/word2float.c */
+StgFloat hs_word2float32(StgWord x);
+StgDouble hs_word2float64(StgWord x);
+
+#endif /* PRIM_H */



More information about the ghc-commits mailing list