Skip to content
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

Configure compiler and silence warnings of Clang-17 #1

Merged
merged 10 commits into from
Mar 11, 2024
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
57 changes: 57 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: CI

on:
pull_request:
push:
branches:
- master

jobs:
build:
name: ${{matrix.name}}
runs-on: ${{matrix.os}}
env:
CC: ${{matrix.cc}}
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
include:
- name: Ubuntu-GCC
cc: gcc
os: ubuntu-latest

- name: Ubuntu-Clang
cc: clang
os: ubuntu-latest

- name: macOS-AppleClang
cc: clang
os: macos-latest

steps:
- uses: actions/checkout@v4

- name: System Information
run: |
awk -v a=$(uname) 'BEGIN { a == "Linux" ? system("cat /etc/issue") : system("sw_vers") }'
${CC} --version

- name: Make
run: |
make

- name: Generate SF 0.01 Data
run: |
mkdir generated_data && cd generated_data
../dbgen -f -s 0.01 -k -b ../dists.dss

- name: Generate Queries
run: |
mkdir generated_queries && cd generated_queries && ln -s ../queries/*.sql .
# With skew and seed 123.
../qgen -k -s 0.01 -b ../dists.dss -r 123 -l params > /dev/null
# Without skew and seed 1234.
../qgen -s 0.01 -b ../dists.dss -r 1234 -l params > /dev/null
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
################
## CHANGE NAME OF ANSI COMPILER HERE
################
CC = gcc
CC ?= gcc
# Current values for DATABASE are: INFORMIX, DB2, TDAT (Teradata)
# SQLSERVER, SYBASE, ORACLE, VECTORWISE
# Current values for MACHINE are: ATT, DOS, HP, IBM, ICL, MVS,
Expand All @@ -10,8 +10,8 @@ CC = gcc
DATABASE= VECTORWISE
MACHINE = LINUX
WORKLOAD = TPCH
#
CFLAGS = -g -O3 -DDBNAME=\"dss\" -D$(MACHINE) -D$(DATABASE) -D$(WORKLOAD) -DRNG_TEST -D_FILE_OFFSET_BITS=64 -DJCCH_SKEW=1
# HYRISE: Add -O3, remove -g. Add -Wno-dangling-else.
CFLAGS = -O3 -DDBNAME=\"dss\" -D$(MACHINE) -D$(DATABASE) -D$(WORKLOAD) -DRNG_TEST -D_FILE_OFFSET_BITS=64 -DJCCH_SKEW=1 -Wno-dangling-else
LDFLAGS = -O3
# The OBJ,EXE and LIB macros will need to be changed for compilation under
# Windows NT
Expand Down
3 changes: 3 additions & 0 deletions README → README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
![Build Status](https://github.com/hyrise/jcch-dbgen/actions/workflows/ci.yml/badge.svg?branch=master)
### Note: This fork is adapted for compilation using recent versions of Clang and GCC, which we ensure with a [GitHub action](https://github.com/hyrise/jcch-dbgen/actions).

# @(#)README 2.4.0-JCCH
========================== JCC-H specific info =========================

Expand Down
13 changes: 8 additions & 5 deletions build.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ mk_cust(DSS_HUGE n_cust, customer_t * c)

if (!bInit)
{
sprintf(szFormat, C_NAME_FMT, 9, HUGE_FORMAT + 1);
// HYRISE: Adapt string indexing.
sprintf(szFormat, C_NAME_FMT, 9, &HUGE_FORMAT[1]);
bInit = 1;
}
c->custkey = n_cust;
Expand Down Expand Up @@ -294,7 +295,8 @@ mk_order(DSS_HUGE index, order_t * o, long upd_num)

if (!bInit)
{
sprintf(szFormat, O_CLRK_FMT, 9, HUGE_FORMAT + 1);
// HYRISE: Adapt string indexing.
sprintf(szFormat, O_CLRK_FMT, 9, &HUGE_FORMAT[1]);
bInit = 1;
}
if (asc_date == NULL)
Expand Down Expand Up @@ -471,8 +473,9 @@ mk_part(DSS_HUGE index, part_t * p)

if (!bInit)
{
sprintf(szFormat, P_MFG_FMT, 1, HUGE_FORMAT + 1);
sprintf(szBrandFormat, P_BRND_FMT, 2, HUGE_FORMAT + 1);
// HYRISE: Adapt string indexing.
sprintf(szFormat, P_MFG_FMT, 1, &HUGE_FORMAT[1]);
sprintf(szBrandFormat, P_BRND_FMT, 2, &HUGE_FORMAT[1]);
bInit = 1;
}
p->partkey = index;
Expand Down Expand Up @@ -560,7 +563,7 @@ mk_supp(DSS_HUGE index, supplier_t * s)

if (!bInit)
{
sprintf(szFormat, S_NAME_FMT, 9, HUGE_FORMAT + 1);
sprintf(szFormat, S_NAME_FMT, 9, &HUGE_FORMAT[1]);
bInit = 1;
}
s->suppkey = index;
Expand Down
34 changes: 20 additions & 14 deletions driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,16 +158,18 @@ static int bTableSet = 0;
/*
* flat file print functions; used with -F(lat) option
*/
int pr_cust (customer_t * c, int mode);
int pr_line (order_t * o, int mode);
int pr_order (order_t * o, int mode);
int pr_part (part_t * p, int mode);
int pr_psupp (part_t * p, int mode);
int pr_supp (supplier_t * s, int mode);
int pr_order_line (order_t * o, int mode);
int pr_part_psupp (part_t * p, int mode);
int pr_nation (code_t * c, int mode);
int pr_region (code_t * c, int mode);
// HYRISE: change first parameter to void pointer so the tdef loader member can have a function prototype
// (C2x compatibility).
int pr_cust (void * c, int mode);
int pr_line (void * o, int mode);
int pr_order (void * o, int mode);
int pr_part (void * p, int mode);
int pr_psupp (void * p, int mode);
int pr_supp (void * s, int mode);
int pr_order_line (void * o, int mode);
int pr_part_psupp (void * p, int mode);
int pr_nation (void * c, int mode);
int pr_region (void * c, int mode);

/*
* seed generation functions; used with '-O s' option
Expand Down Expand Up @@ -370,7 +372,8 @@ gen_tbl (int tnum, DSS_HUGE start, DSS_HUGE count, long upd_num)
row_stop(tnum);
if (set_seeds && (i % tdefs[tnum].base) < 2)
{
printf("\nSeeds for %s at rowcount %ld\n", tdefs[tnum].comment, i);
// HYRISE: Change format specifier.
printf("\nSeeds for %s at rowcount %lld\n", tdefs[tnum].comment, i);
dump_seeds(tnum);
}
}
Expand Down Expand Up @@ -445,7 +448,8 @@ partial (int tbl, int s)

if (verbose > 0)
{
fprintf (stderr, "\tStarting to load stage %d of %d for %s...",
// HYRISE: Change format specifier.
fprintf (stderr, "\tStarting to load stage %d of %ld for %s...",
s, children, tdefs[tbl].comment);
}

Expand Down Expand Up @@ -622,7 +626,8 @@ process_options (int count, char **vector)
}
part.s = (partsupp_t*) malloc(SUPP_PER_PART * sizeof(partsupp_t));
if (part.s == NULL) {
fprintf(stderr, "ERROR Allocating memory for %lld suppliers.\n", SUPP_PER_PART);
// HYRISE: Change format specifier.
fprintf(stderr, "ERROR Allocating memory for %d suppliers.\n", SUPP_PER_PART);
exit(-1);
}

Expand Down Expand Up @@ -785,8 +790,9 @@ main (int ac, char **av)
while (upd_num < updates)
{
if (verbose > 0)
// HYRISE: Change format specifier.
fprintf (stderr,
"Generating update pair #%d for %s",
"Generating update pair #%ld for %s",
upd_num + 1, tdefs[ORDER_LINE].comment);
insert_orders_segment=0;
insert_lineitem_segment=0;
Expand Down
8 changes: 5 additions & 3 deletions dss.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,9 @@ typedef struct
char *name;
char *comment;
DSS_HUGE base;
int (*loader) ();
long (*gen_seed)();
int (*loader) (void * t, int);
// HYRISE: add function prototypes (C2x compatibility).
long (*gen_seed)(int, DSS_HUGE);
int child;
DSS_HUGE vtotal;
} tdef;
Expand Down Expand Up @@ -489,8 +490,9 @@ int dbg_print(int dt, FILE *tgt, void *data, int len, int eol);
#define PR_DATE(tgt, yr, mn, dy) \
sprintf(tgt, "%02d-%02d-19%02d", mn, dy, yr)
#else
// HYRISE: Change format specifier.
#define PR_DATE(tgt, yr, mn, dy) \
sprintf(tgt, "19%02d-%02d-%02d", yr, mn, dy)
sprintf(tgt, "19%02ld-%02ld-%02ld", yr, mn, dy)
#endif /* DATE_FORMAT */

/*
Expand Down
24 changes: 18 additions & 6 deletions dsstypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ typedef struct
} customer_t;
/* customers.c */
long mk_cust PROTO((DSS_HUGE n_cust, customer_t * c));
int pr_cust PROTO((customer_t * c, int mode));
// HYRISE: change first parameter to void pointer so the tdef loader member can have a function prototype
// (C2x compatibility).
int pr_cust PROTO((void * c, int mode));
int ld_cust PROTO((customer_t * c, int mode));

typedef struct
Expand Down Expand Up @@ -95,7 +97,9 @@ typedef struct

/* order.c */
long mk_order PROTO((DSS_HUGE index, order_t * o, long upd_num));
int pr_order PROTO((order_t * o, int mode));
// HYRISE: change first parameter to void pointer so the tdef loader member can have a function prototype
// (C2x compatibility).
int pr_order PROTO((void * o, int mode));
int ld_order PROTO((order_t * o, int mode));
void mk_sparse PROTO((DSS_HUGE index, DSS_HUGE *ok, long seq));

Expand Down Expand Up @@ -131,7 +135,9 @@ typedef struct

/* parts.c */
long mk_part PROTO((DSS_HUGE index, part_t * p));
int pr_part PROTO((part_t * part, int mode));
// HYRISE: change first parameter to void pointer so the tdef loader member can have a function prototype
// (C2x compatibility).
int pr_part PROTO((void * part, int mode));
int ld_part PROTO((part_t * part, int mode));

typedef struct
Expand All @@ -148,7 +154,9 @@ typedef struct
} supplier_t;
/* supplier.c */
long mk_supp PROTO((DSS_HUGE index, supplier_t * s));
int pr_supp PROTO((supplier_t * supp, int mode));
// HYRISE: change first parameter to void pointer so the tdef loader member can have a function prototype
// (C2x compatibility).
int pr_supp PROTO((void * supp, int mode));
int ld_supp PROTO((supplier_t * supp, int mode));

typedef struct
Expand Down Expand Up @@ -178,9 +186,13 @@ typedef struct

/* code table */
int mk_nation PROTO((DSS_HUGE i, code_t * c));
int pr_nation PROTO((code_t * c, int mode));
// HYRISE: change first parameter to void pointer so the tdef loader member can have a function prototype
// (C2x compatibility).
int pr_nation PROTO((void * c, int mode));
int ld_nation PROTO((code_t * c, int mode));
int mk_region PROTO((DSS_HUGE i, code_t * c));
int pr_region PROTO((code_t * c, int mode));
// HYRISE: change first parameter to void pointer so the tdef loader member can have a function prototype
// (C2x compatibility).
int pr_region PROTO((void * c, int mode));
int ld_region PROTO((code_t * c, int mode));

31 changes: 19 additions & 12 deletions print.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ dbg_print(int format, FILE *target, void *data, int len, int sep)
}
dollars = cents / 100;
cents %= 100;
fprintf(target, "%ld.%02ld", dollars, cents);
// HYRISE: Change format specifier.
fprintf(target, "%d.%02d", dollars, cents);
break;
case DT_CHR:
fprintf(target, "%c", *(char *)data);
Expand All @@ -151,9 +152,10 @@ dbg_print(int format, FILE *target, void *data, int len, int sep)
}

int
pr_cust(customer_t *c, int mode)
pr_cust(void *t, int mode)
{
static FILE *fp = NULL;
static FILE *fp = NULL;
customer_t *c = (customer_t *) t;

if (fp == NULL)
fp = print_prep(CUST, 0);
Expand All @@ -179,10 +181,11 @@ static FILE *fp = NULL;
* print the numbered order
*/
int
pr_order(order_t *o, int mode)
pr_order(void *t, int mode)
{
static FILE *fp_o = NULL;
static int last_mode = 0;
order_t *o = (order_t *) t;

if (fp_o == NULL || mode != last_mode)
{
Expand Down Expand Up @@ -266,9 +269,10 @@ pr_order_line(order_t *o, int mode)
* print the given part
*/
int
pr_part(part_t *part, int mode)
pr_part(void *t, int mode)
{
static FILE *p_fp = NULL;
static FILE *p_fp = NULL;
part_t *part = (part_t *) t;

if (p_fp == NULL)
p_fp = print_prep(PART, 0);
Expand Down Expand Up @@ -331,9 +335,10 @@ pr_part_psupp(part_t *part, int mode)
}

int
pr_supp(supplier_t *supp, int mode)
pr_supp(void *t, int mode)
{
static FILE *fp = NULL;
static FILE *fp = NULL;
supplier_t *supp = (supplier_t *) t;

if (fp == NULL)
fp = print_prep(SUPP, mode);
Expand All @@ -352,9 +357,10 @@ static FILE *fp = NULL;
}

int
pr_nation(code_t *c, int mode)
pr_nation(void *t, int mode)
{
static FILE *fp = NULL;
static FILE *fp = NULL;
code_t *c = (code_t *) t;

if (fp == NULL)
fp = print_prep(NATION, mode);
Expand All @@ -370,9 +376,10 @@ static FILE *fp = NULL;
}

int
pr_region(code_t *c, int mode)
pr_region(void *t, int mode)
{
static FILE *fp = NULL;
static FILE *fp = NULL;
code_t *c = (code_t *) t;

if (fp == NULL)
fp = print_prep(REGION, mode);
Expand Down
6 changes: 4 additions & 2 deletions qgen.c
Original file line number Diff line number Diff line change
Expand Up @@ -476,14 +476,16 @@ int main(int ac, char **av)
for (i=optind; i < ac; i++)
{
char qname[10];
sprintf(qname, "%d", SEQUENCE(snum, atoi(av[i])));
// HYRISE: Change format specifier.
sprintf(qname, "%ld", SEQUENCE(snum, atoi(av[i])));
qsub(qname, flags);
}
else
for (i=1; i <= QUERIES_PER_SET; i++)
{
char qname[10];
sprintf(qname, "%d", SEQUENCE(snum, i));
// HYRISE: Change format specifier.
sprintf(qname, "%ld", SEQUENCE(snum, i));
qsub(qname, flags);
}
else
Expand Down
Loading