Skip to content

Regression tests: Ensure __LINE__ is expanded #4557

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

Merged
merged 1 commit into from
Apr 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions regression/ansi-c/Struct_Bitfields1/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#define STATIC_ASSERT(condition) \
int some_array##__LINE__[(condition) ? 1 : -1];
#define CONCAT(a, b) a##b
#define CONCAT2(a, b) CONCAT(a, b)

#define STATIC_ASSERT(condition) \
int CONCAT2(some_array, __LINE__)[(condition) ? 1 : -1]

struct S1
{
Expand Down
7 changes: 5 additions & 2 deletions regression/ansi-c/Struct_Enum_Padding1/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

#include <inttypes.h>

#define STATIC_ASSERT(condition) \
int some_array##__LINE__[(condition) ? 1 : -1]
# define CONCAT(a, b) a##b
# define CONCAT2(a, b) CONCAT(a, b)

# define STATIC_ASSERT(condition) \
int CONCAT2(some_array, __LINE__)[(condition) ? 1 : -1]

// Debian package openvswitch
enum __attribute__((__packed__)) ofpact_type {
Expand Down
7 changes: 5 additions & 2 deletions regression/ansi-c/Struct_Initialization1/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#define STATIC_ASSERT(condition) \
int some_array##__LINE__[(condition) ? 1 : -1]
#define CONCAT(a, b) a##b
#define CONCAT2(a, b) CONCAT(a, b)

#define STATIC_ASSERT(condition) \
int CONCAT2(some_array, __LINE__)[(condition) ? 1 : -1]

struct A {
int x;
Expand Down
7 changes: 5 additions & 2 deletions regression/ansi-c/Struct_Initialization2/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#define STATIC_ASSERT(condition) \
int some_array##__LINE__[(condition) ? 1 : -1]
#define CONCAT(a, b) a##b
#define CONCAT2(a, b) CONCAT(a, b)

#define STATIC_ASSERT(condition) \
int CONCAT2(some_array, __LINE__)[(condition) ? 1 : -1]

struct A {
int x;
Expand Down
7 changes: 5 additions & 2 deletions regression/ansi-c/Struct_Padding2/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#define STATIC_ASSERT(condition) \
int some_array##__LINE__[(condition) ? 1 : -1]
#define CONCAT(a, b) a##b
#define CONCAT2(a, b) CONCAT(a, b)

#define STATIC_ASSERT(condition) \
int CONCAT2(some_array, __LINE__)[(condition) ? 1 : -1]

enum {
RTAX_UNSPEC,
Expand Down
7 changes: 5 additions & 2 deletions regression/ansi-c/Struct_Padding3/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#define STATIC_ASSERT(condition) \
int some_array##__LINE__[(condition) ? 1 : -1]
#define CONCAT(a, b) a##b
#define CONCAT2(a, b) CONCAT(a, b)

#define STATIC_ASSERT(condition) \
int CONCAT2(some_array, __LINE__)[(condition) ? 1 : -1]

#ifndef __GNUC__
#define __builtin_offsetof(a, b) ((unsigned long long)&(((a *)0)->b))
Expand Down
7 changes: 5 additions & 2 deletions regression/ansi-c/Struct_Padding4/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#define STATIC_ASSERT(condition) \
int some_array##__LINE__[(condition) ? 1 : -1]
#define CONCAT(a, b) a##b
#define CONCAT2(a, b) CONCAT(a, b)

#define STATIC_ASSERT(condition) \
int CONCAT2(some_array, __LINE__)[(condition) ? 1 : -1]

struct Z1
{
Expand Down
7 changes: 5 additions & 2 deletions regression/ansi-c/Struct_Padding5/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#define STATIC_ASSERT(condition) \
int some_array##__LINE__[(condition) ? 1 : -1]
#define CONCAT(a, b) a##b
#define CONCAT2(a, b) CONCAT(a, b)

#define STATIC_ASSERT(condition) \
int CONCAT2(some_array, __LINE__)[(condition) ? 1 : -1]

#ifdef _MSC_VER

Expand Down
7 changes: 5 additions & 2 deletions regression/ansi-c/Struct_Padding6/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#define STATIC_ASSERT(condition) \
int some_array##__LINE__[(condition) ? 1 : -1]
#define CONCAT(a, b) a##b
#define CONCAT2(a, b) CONCAT(a, b)

#define STATIC_ASSERT(condition) \
int CONCAT2(some_array, __LINE__)[(condition) ? 1 : -1]

#pragma pack(4)

Expand Down
7 changes: 5 additions & 2 deletions regression/ansi-c/Union_Padding1/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#define STATIC_ASSERT(condition) \
int some_array##__LINE__[(condition) ? 1 : -1]
#define CONCAT(a, b) a##b
#define CONCAT2(a, b) CONCAT(a, b)

#define STATIC_ASSERT(condition) \
int CONCAT2(some_array, __LINE__)[(condition) ? 1 : -1]

#ifdef _MSC_VER

Expand Down
7 changes: 5 additions & 2 deletions regression/ansi-c/Universal_characters1/main.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
int identifier_\u0201_;
int \u0201_abc;

#define STATIC_ASSERT(condition) \
int some_array##__LINE__[(condition) ? 1 : -1];
#define CONCAT(a, b) a##b
#define CONCAT2(a, b) CONCAT(a, b)

#define STATIC_ASSERT(condition) \
int CONCAT2(some_array, __LINE__)[(condition) ? 1 : -1]

char my_string[]="\u0201";
STATIC_ASSERT(sizeof(my_string)==3);
Expand Down
7 changes: 5 additions & 2 deletions regression/ansi-c/_Alignof1/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#define STATIC_ASSERT(condition) \
int some_array##__LINE__[(condition) ? 1 : -1];
#define CONCAT(a, b) a##b
#define CONCAT2(a, b) CONCAT(a, b)

#define STATIC_ASSERT(condition) \
int CONCAT2(some_array, __LINE__)[(condition) ? 1 : -1]

// C11: _Alignof
// 6.5.3.4
Expand Down
7 changes: 5 additions & 2 deletions regression/ansi-c/_Bool1/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#define STATIC_ASSERT(condition) \
int some_array##__LINE__[(condition) ? 1 : -1];
#define CONCAT(a, b) a##b
#define CONCAT2(a, b) CONCAT(a, b)

#define STATIC_ASSERT(condition) \
int CONCAT2(some_array, __LINE__)[(condition) ? 1 : -1]

// C11:
// 6.3.1.2 Boolean type
Expand Down
7 changes: 5 additions & 2 deletions regression/ansi-c/_Generic1/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#define STATIC_ASSERT(condition) \
int some_array##__LINE__[(condition) ? 1 : -1];
#define CONCAT(a, b) a##b
#define CONCAT2(a, b) CONCAT(a, b)

#define STATIC_ASSERT(condition) \
int CONCAT2(some_array, __LINE__)[(condition) ? 1 : -1]

#define G(X) _Generic((X), \
long double: 1, \
Expand Down
7 changes: 5 additions & 2 deletions regression/ansi-c/array_initialization1/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#define STATIC_ASSERT(condition) \
int some_array##__LINE__[(condition) ? 1 : -1]
#define CONCAT(a, b) a##b
#define CONCAT2(a, b) CONCAT(a, b)

#define STATIC_ASSERT(condition) \
int CONCAT2(some_array, __LINE__)[(condition) ? 1 : -1]

// 6.7.9, 14: An array of character type may be initialized by a character
// string literal or UTF−8 string literal, optionally enclosed in braces.
Expand Down
7 changes: 5 additions & 2 deletions regression/ansi-c/array_initialization3/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#define STATIC_ASSERT_sizeof(condition) \
int[(condition) ? 1 : -1]
#define CONCAT(a, b) a##b
#define CONCAT2(a, b) CONCAT(a, b)

#define STATIC_ASSERT(condition) \
int CONCAT2(some_array, __LINE__)[(condition) ? 1 : -1]

int A[];
int B[];
Expand Down
6 changes: 5 additions & 1 deletion regression/ansi-c/bitfields1/main.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#include <limits.h>

#define STATIC_ASSERT(condition) int some_array##__LINE__[(condition) ? 1 : -1]
#define CONCAT(a, b) a##b
#define CONCAT2(a, b) CONCAT(a, b)

#define STATIC_ASSERT(condition) \
int CONCAT2(some_array, __LINE__)[(condition) ? 1 : -1]

#if CHAR_BIT == 8
struct bits
Expand Down
7 changes: 5 additions & 2 deletions regression/ansi-c/character_literals1/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#define STATIC_ASSERT(condition) \
int some_array##__LINE__[(condition) ? 1 : -1];
#define CONCAT(a, b) a##b
#define CONCAT2(a, b) CONCAT(a, b)

#define STATIC_ASSERT(condition) \
int CONCAT2(some_array, __LINE__)[(condition) ? 1 : -1]

// character literals such as are of type int in C
STATIC_ASSERT(sizeof('a')==sizeof(int));
Expand Down
6 changes: 5 additions & 1 deletion regression/ansi-c/cprover_bool1/main.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#define STATIC_ASSERT(condition) int some_array##__LINE__[(condition) ? 1 : -1]
#define CONCAT(a, b) a##b
#define CONCAT2(a, b) CONCAT(a, b)

#define STATIC_ASSERT(condition) \
int CONCAT2(some_array, __LINE__)[(condition) ? 1 : -1]

struct bits
{
Expand Down
7 changes: 5 additions & 2 deletions regression/ansi-c/enum3/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#define STATIC_ASSERT(condition) \
int some_array##__LINE__[(condition) ? 1 : -1]
#define CONCAT(a, b) a##b
#define CONCAT2(a, b) CONCAT(a, b)

#define STATIC_ASSERT(condition) \
int CONCAT2(some_array, __LINE__)[(condition) ? 1 : -1]

#if defined(__GNUC__)

Expand Down
7 changes: 5 additions & 2 deletions regression/ansi-c/float_constant1/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#define STATIC_ASSERT(condition) \
int some_array##__LINE__[(condition) ? 1 : -1];
#define CONCAT(a, b) a##b
#define CONCAT2(a, b) CONCAT(a, b)

#define STATIC_ASSERT(condition) \
int CONCAT2(some_array, __LINE__)[(condition) ? 1 : -1]

// hex-based constants
STATIC_ASSERT(0x1.0p-95f == 2.524355e-29f);
Expand Down
7 changes: 5 additions & 2 deletions regression/ansi-c/gcc_attributes10/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#define STATIC_ASSERT(condition) \
int array##__LINE__[(condition) ? 1 : -1]
#define CONCAT(a, b) a##b
#define CONCAT2(a, b) CONCAT(a, b)

#define STATIC_ASSERT(condition) \
int CONCAT2(some_array, __LINE__)[(condition) ? 1 : -1]

#ifdef __GNUC__
#ifndef __clang__
Expand Down
7 changes: 5 additions & 2 deletions regression/ansi-c/gcc_attributes3/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#define STATIC_ASSERT(condition) \
int some_array##__LINE__[(condition) ? 1 : -1];
#define CONCAT(a, b) a##b
#define CONCAT2(a, b) CONCAT(a, b)

#define STATIC_ASSERT(condition) \
int CONCAT2(some_array, __LINE__)[(condition) ? 1 : -1]

#ifdef __GNUC__

Expand Down
7 changes: 5 additions & 2 deletions regression/ansi-c/gcc_attributes4/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#define STATIC_ASSERT(condition) \
int some_array[(condition) ? 1 : -1];
#define CONCAT(a, b) a##b
#define CONCAT2(a, b) CONCAT(a, b)

#define STATIC_ASSERT(condition) \
int CONCAT2(some_array, __LINE__)[(condition) ? 1 : -1]

#ifdef __GNUC__

Expand Down
7 changes: 5 additions & 2 deletions regression/ansi-c/gcc_attributes5/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#define STATIC_ASSERT(condition) \
int some_array##__LINE__[(condition) ? 1 : -1];
#define CONCAT(a, b) a##b
#define CONCAT2(a, b) CONCAT(a, b)

#define STATIC_ASSERT(condition) \
int CONCAT2(some_array, __LINE__)[(condition) ? 1 : -1]

#ifdef __GNUC__

Expand Down
7 changes: 5 additions & 2 deletions regression/ansi-c/gcc_attributes6/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#define STATIC_ASSERT(condition) \
int some_array[(condition) ? 1 : -1];
#define CONCAT(a, b) a##b
#define CONCAT2(a, b) CONCAT(a, b)

#define STATIC_ASSERT(condition) \
int CONCAT2(some_array, __LINE__)[(condition) ? 1 : -1]

#ifdef __GNUC__

Expand Down
7 changes: 5 additions & 2 deletions regression/ansi-c/gcc_attributes8/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#define STATIC_ASSERT(condition) \
int some_array[(condition) ? 1 : -1];
#define CONCAT(a, b) a##b
#define CONCAT2(a, b) CONCAT(a, b)

#define STATIC_ASSERT(condition) \
int CONCAT2(some_array, __LINE__)[(condition) ? 1 : -1]

#ifdef __GNUC__

Expand Down
6 changes: 5 additions & 1 deletion regression/ansi-c/gcc_builtins2/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ extern double cabs (double _Complex __z);
extern double fabs (double __x);
extern long double cabsl (long double _Complex __z);

#define STATIC_ASSERT(a) int __dummy__[(a)?1:-1]
# define CONCAT(a, b) a##b
# define CONCAT2(a, b) CONCAT(a, b)

# define STATIC_ASSERT(condition) \
int CONCAT2(some_array, __LINE__)[(condition) ? 1 : -1]
#endif

int main()
Expand Down
6 changes: 5 additions & 1 deletion regression/ansi-c/gcc_builtins4/main.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifdef __GNUC__

#define STATIC_ASSERT(a) int __dummy__[(a)?1:-1]
# define CONCAT(a, b) a##b
# define CONCAT2(a, b) CONCAT(a, b)

# define STATIC_ASSERT(condition) \
int CONCAT2(some_array, __LINE__)[(condition) ? 1 : -1]

struct { int i; _Bool bit_field : 1; } s;
union { int i; } u;
Expand Down
6 changes: 5 additions & 1 deletion regression/ansi-c/gcc_builtins5/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ struct pthread
};
};

#define STATIC_ASSERT(a) int __dummy__[(a)?1:-1]
# define CONCAT(a, b) a##b
# define CONCAT2(a, b) CONCAT(a, b)

# define STATIC_ASSERT(condition) \
int CONCAT2(some_array, __LINE__)[(condition) ? 1 : -1]

int main()
{
Expand Down
7 changes: 5 additions & 2 deletions regression/ansi-c/gcc_types_compatible_p1/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#define STATIC_ASSERT(condition) \
int some_array[(condition) ? 1 : -1];
#define CONCAT(a, b) a##b
#define CONCAT2(a, b) CONCAT(a, b)

#define STATIC_ASSERT(condition) \
int CONCAT2(some_array, __LINE__)[(condition) ? 1 : -1]

int i;
double d;
Expand Down
7 changes: 5 additions & 2 deletions regression/ansi-c/gcc_types_compatible_p2/main.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#ifdef __GNUC__

#define STATIC_ASSERT(condition) \
int some_array##__LINE__[(condition) ? 1 : -1]
# define CONCAT(a, b) a##b
# define CONCAT2(a, b) CONCAT(a, b)

# define STATIC_ASSERT(condition) \
int CONCAT2(some_array, __LINE__)[(condition) ? 1 : -1]

int getopt_long(int i, char * const* s);
int getopt_long_nn(int, char * const*);
Expand Down
7 changes: 5 additions & 2 deletions regression/ansi-c/gcc_types_compatible_p3/main.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#ifdef __GNUC__

#define STATIC_ASSERT(condition) \
int some_array##__LINE__[(condition) ? 1 : -1]
# define CONCAT(a, b) a##b
# define CONCAT2(a, b) CONCAT(a, b)

# define STATIC_ASSERT(condition) \
int CONCAT2(some_array, __LINE__)[(condition) ? 1 : -1]

// Debian package linux-tools
enum help_format {
Expand Down
7 changes: 5 additions & 2 deletions regression/ansi-c/gcc_types_compatible_p4/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#define STATIC_ASSERT(condition) \
int some_array[(condition) ? 1 : -1];
#define CONCAT(a, b) a##b
#define CONCAT2(a, b) CONCAT(a, b)

#define STATIC_ASSERT(condition) \
int CONCAT2(some_array, __LINE__)[(condition) ? 1 : -1]

typedef struct struct_tag
{
Expand Down
7 changes: 5 additions & 2 deletions regression/ansi-c/integer_constant1/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#define STATIC_ASSERT(condition) \
int some_array##__LINE__[(condition) ? 1 : -1];
#define CONCAT(a, b) a##b
#define CONCAT2(a, b) CONCAT(a, b)

#define STATIC_ASSERT(condition) \
int CONCAT2(some_array, __LINE__)[(condition) ? 1 : -1]

STATIC_ASSERT('\''==39);
STATIC_ASSERT(L'\''==39);
Expand Down
Loading