language-c 0.6 → 0.6.1
raw patch · 8 files changed
+72/−12 lines, 8 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Language.C.Data: sueRefToString :: SUERef -> String
+ Language.C.Data.Ident: sueRefToString :: SUERef -> String
Files
- ChangeLog +51/−0
- language-c.cabal +1/−1
- src/Language/C/Analysis/ConstEval.hs +0/−2
- src/Language/C/Analysis/TravMonad.hs +5/−5
- src/Language/C/Analysis/TypeCheck.hs +1/−1
- src/Language/C/Data.hs +1/−1
- src/Language/C/Data/Ident.hs +7/−1
- test/harness/run-harness.hs +6/−1
ChangeLog view
@@ -1,5 +1,56 @@+Changes since 0.6.0+==========================================================================++Changes since 0.5.0+==========================================================================+Thu Feb 23 2017+ * Make gccParseCPPArgs grab the arg to -MF -MT and -MQ+Wed Feb 15 2017+ * In enums, allow multiple attribute specifiers per enumerator+Tue Feb 21 2017+ * Allow typedef redefinition if it denotes the same type+Tue Feb 21 2017+ * Change TypeDefRef to store Type, not Maybe Type+Tue Feb 14 2017+ * Parse (and ignore) Clang __attribute__((availability(id=major.minor.rev)))+Sun Sep 11 2016+ * Add __builtin_bswap32/64.+Wed Jun 22 2016+ * Add '_Alignof' to Lexer.x (fixes #7)+Mon Jun 27 2016+ * Updates for C11 (part 1)+ * _Nullable and _Nonnull support as well as Warnings/lint fixes provided by Anthony Cowley (https://github.com/acowley)+Wed Mar 16 2016+ * Consider storage specifier "ThreadSpec" for global and local declarations+Tue Mar 15 2016+ * Support C11 _NoReturn, genearlize is_inline to FunSpecs (Syntax) / FunAttrs (SemRep)++Changes since 0.4.3+==========================================================================+Wed Mar 2 2016+ * Add direct base type BaseInt128 (complements previous __int128 patch)+ ryan.gl.scott@gmail.com+Sun Feb 28 2016+ * Parse gcc-specific __int128 type+Thu Dec 4 2014+ * Scott Kovach <dskovach@gmail.com>: added derived Eq,Ord instances to NodeInfo++Changes since 0.4.2+==========================================================================+Sat Jan 11 2014+ * Allow unicode characters in string/char literals and filenames+Mon Oct 27 2014+ * macos-attributes+Tue Aug 13 2013+ * Do not derive Error instances for newtypes (type parameter has non-parametric role)+Mon Aug 12 2013+ * Fix bug caused by applying posFile to nopos (reported by Mikhail Sosonkin)+ Changes since 0.4.1 ==========================================================================+Tue Mar 19 2013+ * TypeCheck: Return Left str instead of fail str (do not rely on MonadError instance of Either)+ * Improve printing of SUERefs and Ident Thu Feb 28 2013 * Fix parsing and printing of octal character escapes. Tue Jun 12 2012
language-c.cabal view
@@ -1,5 +1,5 @@ Name: language-c-Version: 0.6+Version: 0.6.1 Cabal-Version: >= 1.8 Build-Type: Simple License: BSD3
src/Language/C/Analysis/ConstEval.hs view
@@ -60,8 +60,6 @@ -} sizeofType md n (TypeDefType (TypeDefRef _ t _) _ _) = sizeofType md n t sizeofType md _ (FunctionType _ _) = return $ ptrSize md-sizeofType _ n t = astError (nodeInfo n) $- "can't find size of type: " ++ (render . pretty) t alignofType :: (MonadTrav m, CNode n) => MachineDesc -> n -> Type -> m Integer alignofType md _ (DirectType TyVoid _ _) = return $ voidAlign md
src/Language/C/Analysis/TravMonad.hs view
@@ -118,7 +118,7 @@ handleTagDecl :: (MonadCError m, MonadSymtab m) => TagFwdDecl -> m () handleTagDecl decl = do redecl <- withDefTable $ declareTag (sueRef decl) decl- checkRedef (show $ sueRef decl) decl redecl+ checkRedef (sueRefToString $ sueRef decl) decl redecl -- | define the given composite type or enumeration -- If there is a declaration visible, overwrite it with the definition.@@ -127,14 +127,14 @@ handleTagDef :: (MonadTrav m) => TagDef -> m () handleTagDef def = do redecl <- withDefTable $ defineTag (sueRef def) def- checkRedef (show $ sueRef def) def redecl+ checkRedef (sueRefToString $ sueRef def) def redecl handleDecl (TagEvent def) handleEnumeratorDef :: (MonadCError m, MonadSymtab m) => Enumerator -> m () handleEnumeratorDef enumerator = do let ident = declIdent enumerator redecl <- withDefTable $ defineScopedIdent ident (EnumeratorDef enumerator)- checkRedef (show ident) ident redecl+ checkRedef (identToString ident) ident redecl return () handleTypeDef :: (MonadTrav m) => TypeDef -> m ()@@ -147,7 +147,7 @@ -- provided that type is not a variably modified type; case redecl of Redeclared (Left (TypeDef _ t2 _ _)) | sameType t1 t2 -> return ()- _ -> checkRedef (show ident) typeDef redecl+ _ -> checkRedef (identToString ident) typeDef redecl handleDecl (TypeDefEvent typeDef) return () @@ -157,7 +157,7 @@ redefErr :: (MonadCError m, CNode old, CNode new) => Ident -> ErrorLevel -> new -> old -> RedefKind -> m () redefErr name lvl new old kind =- throwTravError $ redefinition lvl (show name) kind (nodeInfo new) (nodeInfo old)+ throwTravError $ redefinition lvl (identToString name) kind (nodeInfo new) (nodeInfo old) -- TODO: unused _checkIdentTyRedef :: (MonadCError m) => IdentEntry -> (DeclarationStatus IdentEntry) -> m ()
src/Language/C/Analysis/TypeCheck.hs view
@@ -163,7 +163,7 @@ let quals = mergeTypeQuals (typeQuals t1) (typeQuals t2) attrs = mergeAttrs (typeAttrs t1) (typeAttrs t2) return (PtrType t quals attrs)-compositeType (TypeDefType tdr1 q1 a1) (TypeDefType tdr2 q2 a2) =+compositeType (TypeDefType tdr1 _q1 _a1) (TypeDefType tdr2 _q2 _a2) = case (tdr1, tdr2) of (TypeDefRef _ t1 _, TypeDefRef _ t2 _) -> compositeType t1 t2
src/Language/C/Data.hs view
@@ -14,7 +14,7 @@ -- * Input stream module Language.C.Data.InputStream, -- * Identifiers- SUERef(..), isAnonymousRef,+ SUERef(..), isAnonymousRef, sueRefToString, Ident,mkIdent, identToString, internalIdent, isInternalIdent, builtinIdent, -- * Unqiue names Name(..),newNameSupply,
src/Language/C/Data/Ident.hs view
@@ -17,7 +17,8 @@ module Language.C.Data.Ident ( Ident(..), SUERef(..), isAnonymousRef,- mkIdent, builtinIdent, internalIdent, internalIdentAt, isInternalIdent, identToString, dumpIdent)+ mkIdent, builtinIdent, internalIdent, internalIdentAt, isInternalIdent,+ identToString, sueRefToString, dumpIdent) where -- TODO (comment from manuel):@@ -122,6 +123,11 @@ -- | string of an identifier identToString :: Ident -> String identToString (Ident s _ _) = s++-- | string of a SUE ref (empty if anonymous)+sueRefToString :: SUERef -> String+sueRefToString (AnonymousRef _) = ""+sueRefToString (NamedRef ident) = identToString ident -- | dump the identifier string and its positions for debugging purposes dumpIdent :: Ident -> String
test/harness/run-harness.hs view
@@ -1,7 +1,7 @@ module Main where import Data.List (intercalate)-import System.Exit (ExitCode(..), exitFailure, exitSuccess)+import System.Exit (ExitCode(..), exitFailure, exitSuccess, exitWith) import System.Directory (doesDirectoryExist, doesFileExist, getCurrentDirectory, setCurrentDirectory, getDirectoryContents) import System.FilePath ((</>))@@ -36,6 +36,11 @@ main :: IO ExitCode main = do actual_test_dir <- getActualTestDirectory testDirs+ has_makefile <- doesFileExist (actual_test_dir </> "Makefile")+ when (not has_makefile) $ do+ hPutStrLn stderr "No Makefile found (out of source tree)"+ hPutStrLn stderr "Skipping harness test"+ exitWith ExitSuccess tests <- subdirectoriesOf actual_test_dir cdir <- getCurrentDirectory hPutStrLn stderr ("Changing to test directory " ++ actual_test_dir ++ " and compiling")