-
Notifications
You must be signed in to change notification settings - Fork 73
WIP: fix warnings #688
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
WIP: fix warnings #688
Changes from all commits
21333a5
269b649
268b6eb
d952fed
303ca49
71fcfa8
d7f0179
895828e
fc5db37
8a8a0b1
4c1e5b5
0308c1d
664260a
a52c577
89863b9
e1d0d55
496382d
898b27a
ec6960a
e2e92e5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,8 +61,8 @@ transExpr (Op2 (UpdateField ty1@(Struct _) ty2 f) e1 e2) = do | |
| e2' <- transExpr e2 | ||
|
|
||
| -- Variable to hold the updated struct | ||
| (i, _, _) <- get | ||
| let varName = "_v" ++ show i | ||
| (i', _, _) <- get | ||
| let varName = "_v" ++ show i' | ||
| modify (\(i, x, y) -> (i + 1, x, y)) | ||
|
|
||
| -- Add new var decl | ||
|
|
@@ -101,14 +101,14 @@ transExpr (Op2 op e1 e2) = do | |
| e2' <- transExpr e2 | ||
| return $ transOp2 op e1' e2' | ||
|
|
||
| transExpr e@(Op3 (UpdateArray arrTy@(Array ty2)) e1 e2 e3) = do | ||
| transExpr (Op3 (UpdateArray arrTy@(Array ty2)) e1 e2 e3) = do | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
| e1' <- transExpr e1 | ||
| e2' <- transExpr e2 | ||
| e3' <- transExpr e3 | ||
|
|
||
| -- Variable to hold the updated array | ||
| (i, _, _) <- get | ||
| let varName = "_v" ++ show i | ||
| (i', _, _) <- get | ||
| let varName = "_v" ++ show i' | ||
|
Comment on lines
+110
to
+111
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
| modify (\(i, x, y) -> (i + 1, x, y)) | ||
|
|
||
| -- Add new var decl | ||
|
|
@@ -117,18 +117,19 @@ transExpr e@(Op3 (UpdateArray arrTy@(Array ty2)) e1 e2 e3) = do | |
| modify (\(i, x, y) -> (i, x ++ [initDecl], y)) | ||
|
|
||
| let size :: Type (Array n t) -> C.Expr | ||
| size arrTy@(Array ty) = C.LitInt (fromIntegral $ typeLength arrTy) | ||
| size arrT'@(Array ty) = C.LitInt (fromIntegral $ typeLength arrT') | ||
| C..* C.SizeOfType (C.TypeName $ transType ty) | ||
| size _ = error "Unhandled case" | ||
|
|
||
| -- Initialize the var to the same value as the original array | ||
| let initStmt = C.Expr $ memcpy (C.Ident varName) e1' (size arrTy) | ||
|
|
||
| -- Update element of array | ||
| let updateStmt = case ty2 of | ||
| Array _ -> C.Expr $ memcpy dest e3' size | ||
| Array _ -> C.Expr $ memcpy dest e3' siz' | ||
| where | ||
| dest = C.Index (C.Ident varName) e2' | ||
| size = C.LitInt | ||
| siz' = C.LitInt | ||
| (fromIntegral $ typeSize ty2) | ||
| C..* C.SizeOfType (C.TypeName (tyElemName ty2)) | ||
|
|
||
|
|
@@ -183,6 +184,7 @@ transOp1 op e = | |
| BwNot _ -> (C..~) e | ||
| Cast _ ty -> C.Cast (transTypeName ty) e | ||
| GetField (Struct _) _ f -> C.Dot e (accessorName f) | ||
| _ -> error "Unhandled case" | ||
|
|
||
| -- | Translates a Copilot binary operator and its arguments into a C99 | ||
| -- expression. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,7 +39,6 @@ library | |
|
|
||
| ghc-options: | ||
| -Wall | ||
| -fno-warn-orphans | ||
|
|
||
|
Comment on lines
41
to
42
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm confused by this. Why is it needed? Is it because it's being added to the specific modules that need it?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the warning tuning flag is used once (Copilot/Core/Type.hs) |
||
| build-depends: | ||
| base >= 4.9 && < 5 | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍