diff --git a/cpp/ql/test/library-tests/dataflow/fields/simple.cpp b/cpp/ql/test/library-tests/dataflow/fields/simple.cpp index d220b416e1a..fb598bd9d71 100644 --- a/cpp/ql/test/library-tests/dataflow/fields/simple.cpp +++ b/cpp/ql/test/library-tests/dataflow/fields/simple.cpp @@ -64,7 +64,7 @@ void single_field_test() A a; a.i = user_input(); A a2 = a; - sink(a2.i); //$ ast,ir + sink(a2.i); // $ ast,ir } struct C { @@ -81,7 +81,7 @@ struct C2 void m() { f2.f1 = user_input(); - sink(getf2f1()); //$ ast,ir + sink(getf2f1()); // $ ast,ir } }; @@ -91,7 +91,7 @@ void single_field_test_typedef(A_typedef a) { a.i = user_input(); A_typedef a2 = a; - sink(a2.i); //$ ast,ir + sink(a2.i); // $ ast,ir } namespace TestAdditionalCallTargets { @@ -168,4 +168,4 @@ void test_union_with_two_instantiations_of_different_sizes() { sink(u_int.y); // $ MISSING: ir } -} // namespace Simple \ No newline at end of file +} // namespace Simple diff --git a/cpp/ql/test/library-tests/dataflow/fields/struct_init.c b/cpp/ql/test/library-tests/dataflow/fields/struct_init.c index d2abfeefc08..2b6716a4bc3 100644 --- a/cpp/ql/test/library-tests/dataflow/fields/struct_init.c +++ b/cpp/ql/test/library-tests/dataflow/fields/struct_init.c @@ -12,14 +12,14 @@ struct Outer { }; void absink(struct AB *ab) { - sink(ab->a); //$ ast,ir=20:20 ast,ir=27:7 ast,ir=40:20 + sink(ab->a); // $ ast,ir=20:20 ast,ir=27:7 ast,ir=40:20 sink(ab->b); // no flow } int struct_init(void) { struct AB ab = { user_input(), 0 }; - sink(ab.a); //$ ast,ir + sink(ab.a); // $ ast,ir sink(ab.b); // no flow absink(&ab); @@ -28,9 +28,9 @@ int struct_init(void) { &ab, }; - sink(outer.nestedAB.a); //$ ast,ir + sink(outer.nestedAB.a); // $ ast,ir sink(outer.nestedAB.b); // no flow - sink(outer.pointerAB->a); //$ ast,ir + sink(outer.pointerAB->a); // $ ast,ir sink(outer.pointerAB->b); // no flow absink(&outer.nestedAB); diff --git a/cpp/ql/test/library-tests/ir/points_to/points_to.cpp b/cpp/ql/test/library-tests/ir/points_to/points_to.cpp index fa4d062c5f8..43a3077d051 100644 --- a/cpp/ql/test/library-tests/ir/points_to/points_to.cpp +++ b/cpp/ql/test/library-tests/ir/points_to/points_to.cpp @@ -24,64 +24,64 @@ struct DerivedVI : virtual Base1 { }; void Locals() { - Point pt = { //$ussa=pt - 1, //$ussa=pt[0..4) - 2 //$ussa=pt[4..8) + Point pt = { // $ ussa=pt + 1, // $ ussa=pt[0..4) + 2 // $ ussa=pt[4..8) }; - int i = pt.x; //$ussa=pt[0..4) - i = pt.y; //$ussa=pt[4..8) + int i = pt.x; // $ ussa=pt[0..4) + i = pt.y; // $ ussa=pt[4..8) int* p = &pt.x; - i = *p; //$ussa=pt[0..4) + i = *p; // $ ussa=pt[0..4) p = &pt.y; - i = *p; //$ussa=pt[4..8) + i = *p; // $ ussa=pt[4..8) } void PointsTo( - int a, //$raw=a - Point& b, //$raw=b ussa=*b - Point* c, //$raw=c ussa=*c - int* d, //$raw=d ussa=*d - DerivedSI* e, //$raw=e ussa=*e - DerivedMI* f, //$raw=f ussa=*f - DerivedVI* g //$raw=g ussa=*g + int a, // $ raw=a + Point& b, // $ raw=b ussa=*b + Point* c, // $ raw=c ussa=*c + int* d, // $ raw=d ussa=*d + DerivedSI* e, // $ raw=e ussa=*e + DerivedMI* f, // $ raw=f ussa=*f + DerivedVI* g // $ raw=g ussa=*g ) { - int i = a; //$raw=a - i = *&a; //$raw=a - i = *(&a + 0); //$raw=a - i = b.x; //$raw=b ussa=*b[0..4) - i = b.y; //$raw=b ussa=*b[4..8) - i = c->x; //$raw=c ussa=*c[0..4) - i = c->y; //$raw=c ussa=*c[4..8) - i = *d; //$raw=d ussa=*d[0..4) - i = *(d + 0); //$raw=d ussa=*d[0..4) - i = d[5]; //$raw=d ussa=*d[20..24) - i = 5[d]; //$raw=d ussa=*d[20..24) - i = d[a]; //$raw=d raw=a ussa=*d[?..?) - i = a[d]; //$raw=d raw=a ussa=*d[?..?) + int i = a; // $ raw=a + i = *&a; // $ raw=a + i = *(&a + 0); // $ raw=a + i = b.x; // $ raw=b ussa=*b[0..4) + i = b.y; // $ raw=b ussa=*b[4..8) + i = c->x; // $ raw=c ussa=*c[0..4) + i = c->y; // $ raw=c ussa=*c[4..8) + i = *d; // $ raw=d ussa=*d[0..4) + i = *(d + 0); // $ raw=d ussa=*d[0..4) + i = d[5]; // $ raw=d ussa=*d[20..24) + i = 5[d]; // $ raw=d ussa=*d[20..24) + i = d[a]; // $ raw=d raw=a ussa=*d[?..?) + i = a[d]; // $ raw=d raw=a ussa=*d[?..?) - int* p = &b.x; //$raw=b - i = *p; //$ussa=*b[0..4) - p = &b.y; //$raw=b - i = *p; //$ussa=*b[4..8) - p = &c->x; //$raw=c - i = *p; //$ussa=*c[0..4) - p = &c->y; //$raw=c - i = *p; //$ussa=*c[4..8) - p = &d[5]; //$raw=d - i = *p; //$ussa=*d[20..24) - p = &d[a]; //$raw=d raw=a - i = *p; //$ussa=*d[?..?) + int* p = &b.x; // $ raw=b + i = *p; // $ ussa=*b[0..4) + p = &b.y; // $ raw=b + i = *p; // $ ussa=*b[4..8) + p = &c->x; // $ raw=c + i = *p; // $ ussa=*c[0..4) + p = &c->y; // $ raw=c + i = *p; // $ ussa=*c[4..8) + p = &d[5]; // $ raw=d + i = *p; // $ ussa=*d[20..24) + p = &d[a]; // $ raw=d raw=a + i = *p; // $ ussa=*d[?..?) - Point* q = &c[a]; //$raw=c raw=a - i = q->x; //$ussa=*c[?..?) - i = q->y; //$ussa=*c[?..?) + Point* q = &c[a]; // $ raw=c raw=a + i = q->x; // $ ussa=*c[?..?) + i = q->y; // $ ussa=*c[?..?) - i = e->b1; //$raw=e ussa=*e[0..4) - i = e->dsi; //$raw=e ussa=*e[4..8) - i = f->b1; //$raw=f ussa=*f[0..4) - i = f->b2; //$raw=f ussa=*f[4..8) - i = f->dmi; //$raw=f ussa=*f[8..12) - i = g->b1; //$raw=g ussa=*g[?..?) - i = g->dvi; //$raw=g ussa=*g[8..12) -} \ No newline at end of file + i = e->b1; // $ raw=e ussa=*e[0..4) + i = e->dsi; // $ raw=e ussa=*e[4..8) + i = f->b1; // $ raw=f ussa=*f[0..4) + i = f->b2; // $ raw=f ussa=*f[4..8) + i = f->dmi; // $ raw=f ussa=*f[8..12) + i = g->b1; // $ raw=g ussa=*g[?..?) + i = g->dvi; // $ raw=g ussa=*g[8..12) +} diff --git a/cpp/ql/test/library-tests/ir/points_to/smart_pointer.cpp b/cpp/ql/test/library-tests/ir/points_to/smart_pointer.cpp index db6be36e42a..0e5d26875d6 100644 --- a/cpp/ql/test/library-tests/ir/points_to/smart_pointer.cpp +++ b/cpp/ql/test/library-tests/ir/points_to/smart_pointer.cpp @@ -10,24 +10,24 @@ struct S { void unique_ptr_init(S s) { unique_ptr p(new S); // MISSING: $ussa=dynamic{1} - int i = (*p).x; //$ MISSING: ussa=dynamic{1}[0..4) - *p = s; //$ MISSING: ussa=dynamic{1}[0..4) + int i = (*p).x; // $ MISSING: ussa=dynamic{1}[0..4) + *p = s; // $ MISSING: ussa=dynamic{1}[0..4) unique_ptr q = std::move(p); - *(q.get()) = s; //$ MISSING: ussa=dynamic{1}[0..4) + *(q.get()) = s; // $ MISSING: ussa=dynamic{1}[0..4) shared_ptr t(std::move(q)); - t->x = 5; //$ MISSING: ussa=dynamic{1}[0..4) - *t = s; //$ MISSING: ussa=dynamic{1}[0..4) - *(t.get()) = s; //$ MISSING: ussa=dynamic{1}[0..4) + t->x = 5; // $ MISSING: ussa=dynamic{1}[0..4) + *t = s; // $ MISSING: ussa=dynamic{1}[0..4) + *(t.get()) = s; // $ MISSING: ussa=dynamic{1}[0..4) } void shared_ptr_init(S s) { - shared_ptr p(new S); //$ MISSING: ussa=dynamic{1} - int i = (*p).x; //$ MISSING: ussa=dynamic{1}[0..4) - *p = s; //$ MISSING: ussa=dynamic{1}[0..4) + shared_ptr p(new S); // $ MISSING: ussa=dynamic{1} + int i = (*p).x; // $ MISSING: ussa=dynamic{1}[0..4) + *p = s; // $ MISSING: ussa=dynamic{1}[0..4) shared_ptr q = std::move(p); - *(q.get()) = s; //$ MISSING: ussa=dynamic{1}[0..4) + *(q.get()) = s; // $ MISSING: ussa=dynamic{1}[0..4) shared_ptr t(q); - t->x = 5; //$ MISSING: ussa=dynamic{1}[0..4) - *t = s; //$ MISSING: ussa=dynamic{1}[0..4) - *(t.get()) = s; //$ MISSING: ussa=dynamic{1}[0..4) + t->x = 5; // $ MISSING: ussa=dynamic{1}[0..4) + *t = s; // $ MISSING: ussa=dynamic{1}[0..4) + *(t.get()) = s; // $ MISSING: ussa=dynamic{1}[0..4) } diff --git a/cpp/ql/test/library-tests/ir/types/complex.c b/cpp/ql/test/library-tests/ir/types/complex.c index d8b18746281..4584bdf104b 100644 --- a/cpp/ql/test/library-tests/ir/types/complex.c +++ b/cpp/ql/test/library-tests/ir/types/complex.c @@ -1,14 +1,14 @@ void Complex(void) { - _Complex float cf; //$irtype=cfloat8 - _Complex double cd; //$irtype=cfloat16 - _Complex long double cld; //$irtype=cfloat32 + _Complex float cf; // $ irtype=cfloat8 + _Complex double cd; // $ irtype=cfloat16 + _Complex long double cld; // $ irtype=cfloat32 // _Complex __float128 cf128; } void Imaginary(void) { - _Imaginary float jf; //$irtype=ifloat4 - _Imaginary double jd; //$irtype=ifloat8 - _Imaginary long double jld; //$irtype=ifloat16 + _Imaginary float jf; // $ irtype=ifloat4 + _Imaginary double jd; // $ irtype=ifloat8 + _Imaginary long double jld; // $ irtype=ifloat16 // _Imaginary __float128 jf128; } diff --git a/cpp/ql/test/library-tests/ir/types/irtypes.cpp b/cpp/ql/test/library-tests/ir/types/irtypes.cpp index 321382567b7..ddc2df8e96d 100644 --- a/cpp/ql/test/library-tests/ir/types/irtypes.cpp +++ b/cpp/ql/test/library-tests/ir/types/irtypes.cpp @@ -22,44 +22,44 @@ enum class ScopedE { }; void IRTypes() { - char c; //$irtype=int1 - signed char sc; //$irtype=int1 - unsigned char uc; //$irtype=uint1 - short s; //$irtype=int2 - signed short ss; //$irtype=int2 - unsigned short us; //$irtype=uint2 - int i; //$irtype=int4 - signed int si; //$irtype=int4 - unsigned int ui; //$irtype=uint4 - long l; //$irtype=int8 - signed long sl; //$irtype=int8 - unsigned long ul; //$irtype=uint8 - long long ll; //$irtype=int8 - signed long long sll; //$irtype=int8 - unsigned long long ull; //$irtype=uint8 - bool b; //$irtype=bool1 - float f; //$irtype=float4 - double d; //$irtype=float8 - long double ld; //$irtype=float16 - __float128 f128; //$irtype=float16 + char c; // $ irtype=int1 + signed char sc; // $ irtype=int1 + unsigned char uc; // $ irtype=uint1 + short s; // $ irtype=int2 + signed short ss; // $ irtype=int2 + unsigned short us; // $ irtype=uint2 + int i; // $ irtype=int4 + signed int si; // $ irtype=int4 + unsigned int ui; // $ irtype=uint4 + long l; // $ irtype=int8 + signed long sl; // $ irtype=int8 + unsigned long ul; // $ irtype=uint8 + long long ll; // $ irtype=int8 + signed long long sll; // $ irtype=int8 + unsigned long long ull; // $ irtype=uint8 + bool b; // $ irtype=bool1 + float f; // $ irtype=float4 + double d; // $ irtype=float8 + long double ld; // $ irtype=float16 + __float128 f128; // $ irtype=float16 - wchar_t wc; //$irtype=uint4 -// char8_t c8; //$irtype=uint1 - char16_t c16; //$irtype=uint2 - char32_t c32; //$irtype=uint4 + wchar_t wc; // $ irtype=uint4 +// char8_t c8; // $ irtype=uint1 + char16_t c16; // $ irtype=uint2 + char32_t c32; // $ irtype=uint4 - int* pi; //$irtype=addr8 - int& ri = i; //$irtype=addr8 - void (*pfn)() = nullptr; //$irtype=func8 - void (&rfn)() = IRTypes; //$irtype=func8 + int* pi; // $ irtype=addr8 + int& ri = i; // $ irtype=addr8 + void (*pfn)() = nullptr; // $ irtype=func8 + void (&rfn)() = IRTypes; // $ irtype=func8 - A s_a; //$irtype=opaque4{A} - B s_b; //$irtype=opaque16{B} + A s_a; // $ irtype=opaque4{A} + B s_b; // $ irtype=opaque16{B} - E e; //$irtype=uint4 - ScopedE se; //$irtype=uint4 + E e; // $ irtype=uint4 + ScopedE se; // $ irtype=uint4 - B a_b[10]; //$irtype=opaque160{B[10]} + B a_b[10]; // $ irtype=opaque160{B[10]} } // semmle-extractor-options: -std=c++17 --clang diff --git a/cpp/ql/test/query-tests/Likely Bugs/Leap Year/UncheckedLeapYearAfterYearModification/test.cpp b/cpp/ql/test/query-tests/Likely Bugs/Leap Year/UncheckedLeapYearAfterYearModification/test.cpp index a2dce39cc85..6e0320e8d84 100644 --- a/cpp/ql/test/query-tests/Likely Bugs/Leap Year/UncheckedLeapYearAfterYearModification/test.cpp +++ b/cpp/ql/test/query-tests/Likely Bugs/Leap Year/UncheckedLeapYearAfterYearModification/test.cpp @@ -1338,7 +1338,7 @@ void indirect_time_conversion_check(WORD year, WORD offset){ void set_time(WORD year, WORD month, WORD day){ SYSTEMTIME tmp; - tmp.wYear = year; //$ Alert[cpp/leap-year/unchecked-after-arithmetic-year-modification] + tmp.wYear = year; // $ Alert[cpp/leap-year/unchecked-after-arithmetic-year-modification] tmp.wMonth = month; tmp.wDay = day; }