Skip to content
Snippets Groups Projects
Commit bbb72301 authored by chrg's avatar chrg
Browse files

Fix many problems

parent f4cadba3
No related branches found
No related tags found
No related merge requests found
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
p.callCabal2nixWithOptions n (nix-filter.lib {root = "${self}/${n}";}) "" {}; p.callCabal2nixWithOptions n (nix-filter.lib {root = "${self}/${n}";}) "" {};
packages = lib: p: { packages = lib: p: {
"language-c" = p.callCabal2nixWithOptions "language-c" inputs.language-c "" {}; "language-c" = lib.dontCheck (p.callCabal2nixWithOptions "language-c" inputs.language-c "" {});
"hspec-glitter" = p.callCabal2nixWithOptions "hspec-glitter" inputs.hspec-glitter "" {}; "hspec-glitter" = p.callCabal2nixWithOptions "hspec-glitter" inputs.hspec-glitter "" {};
"rtree" = lib.dontCheck (load p "rtree"); "rtree" = lib.dontCheck (load p "rtree");
"rtree-c" = lib.dontCheck (load p "rtree-c"); "rtree-c" = lib.dontCheck (load p "rtree-c");
......
...@@ -348,12 +348,13 @@ reduceCStatement smt ctx = case smt of ...@@ -348,12 +348,13 @@ reduceCStatement smt ctx = case smt of
(pure $ Just $ C.CForDecl (C.CDecl rec decl' ni')) (pure $ Just $ C.CForDecl (C.CDecl rec decl' ni'))
else pure $ Just $ C.CForDecl (C.CDecl rec decl' ni') else pure $ Just $ C.CForDecl (C.CDecl rec decl' ni')
pure (res, ctx') pure (res, ctx')
C.CForInitializing e -> C.CForInitializing e -> do
e' <- maybeSplit ("remove initializer", C.posOf ni) (e >>= \e' -> reduceCExpr e' ctx)
whenSplit whenSplit
(AllowEmptyDeclarations `isIn` ctx) (AllowEmptyDeclarations `isIn` ctx)
("remove empty declaration", C.posOf ni) ("remove empty declaration", C.posOf ni)
(pure (Nothing, ctx)) (pure (Nothing, ctx))
(pure (Just $ C.CForInitializing e, ctx)) (pure (Just $ C.CForInitializing e', ctx))
d -> don'tHandle d d -> don'tHandle d
s' <- reduceCStatementOrEmptyBlock s ctx' s' <- reduceCStatementOrEmptyBlock s ctx'
......
static int a = 0;
int main () {
for (a = 0;;) {
}
}
static int a = 0;
int main()
{
for (a = 0;;)
{
}
}
// 0 inline variable a at ("test/cases/small/for.c": line 1)
// 0 remove statement at ("test/cases/small/for.c": line 4)
// 0 remove initializer at ("test/cases/small/for.c": line 4)
// 0 reduce to left at ("test/cases/small/for.c": line 4)
// 0 reduce to right at ("test/cases/small/for.c": line 4)
static int a = 0;
int main()
{
for (a = 0;;)
{
}
}
// 0 inline variable a at ("test/cases/small/for.c": line 1)
// 0 remove statement at ("test/cases/small/for.c": line 4)
// 0 remove initializer at ("test/cases/small/for.c": line 4)
// 0 reduce to left at ("test/cases/small/for.c": line 4)
// 1 reduce to right at ("test/cases/small/for.c": line 4)
static int a = 0;
int main()
{
for (0;;)
{
}
}
// 0 inline variable a at ("test/cases/small/for.c": line 1)
// 0 remove statement at ("test/cases/small/for.c": line 4)
// 0 remove initializer at ("test/cases/small/for.c": line 4)
// 1 reduce to left at ("test/cases/small/for.c": line 4)
static int a = 0;
int main()
{
for (a;;)
{
}
}
// 0 inline variable a at ("test/cases/small/for.c": line 1)
// 0 remove statement at ("test/cases/small/for.c": line 4)
// 1 remove initializer at ("test/cases/small/for.c": line 4)
static int a = 0;
int main()
{
for (;;)
{
}
}
// 0 inline variable a at ("test/cases/small/for.c": line 1)
// 1 remove statement at ("test/cases/small/for.c": line 4)
static int a = 0;
int main()
{
}
// 1 inline variable a at ("test/cases/small/for.c": line 1)
// 0 remove statement at ("test/cases/small/for.c": line 4)
int main()
{
for (;;)
{
}
}
// 1 inline variable a at ("test/cases/small/for.c": line 1)
// 1 remove statement at ("test/cases/small/for.c": line 4)
int main()
{
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment