Skip to content

Commit 32b484e

Browse files
committed
Add support for LLVM 20.
1 parent adc2fa3 commit 32b484e

File tree

3 files changed

+29
-17
lines changed

3 files changed

+29
-17
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ PREFIX = /usr/local
99
DEBUG = -g -O0 -Wall
1010
RELEASE = -O2 -march=native
1111

12-
CFLAGS = $(RELEASE)
12+
CFLAGS = $(RELEASE) -I$(PREFIX)/include
1313
FFLAGS = $(RELEASE)
1414
PPFLAGS = -DSQLITE_ENABLE_COLUMN_METADATA=0
15-
LDFLAGS = -I$(PREFIX)/include -L$(PREFIX)/lib
15+
LDFLAGS = -L$(PREFIX)/lib
1616
LDLIBS = -lsqlite3
1717
ARFLAGS = rcs
1818
INCDIR = $(PREFIX)/include/libfortran-sqlite3

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ $ git clone --depth 1 https://github.com/interkosmos/fortran-sqlite3
3737
$ cd fortran-sqlite3/
3838
```
3939

40-
Either build the library with `fpm` or `make`. Once compiled, link your Fortran
41-
application against `libfortran-sqlite3.a` and `-lsqlite3`.
40+
Either build the library with _fpm(1)_ or _make(1)_. Once compiled, link your
41+
Fortran application against `libfortran-sqlite3.a` and `-lsqlite3`.
4242

4343
### Fortran Package Manager
4444

@@ -50,7 +50,7 @@ $ fpm build --profile release
5050

5151
The output files are written to `build/`.
5252

53-
### make
53+
### Make
5454

5555
Execute the provided `Makefile`:
5656

@@ -178,8 +178,8 @@ contains
178178
end program example
179179
```
180180

181-
If the library is installed to `/opt`, then compile, link, and run the example
182-
with:
181+
If the library has been installed to `/opt`, then compile, link, and run the
182+
example with:
183183

184184
```
185185
$ gfortran -I/opt/include/libfortran-sqlite3 -o example example.f90 /opt/lib/libfortran-sqlite3.a -lsqlite3

src/sqlite3.F90

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,15 @@ module sqlite3
1010
implicit none (type, external)
1111
private
1212

13-
integer, parameter :: c_unsigned_int = c_int
13+
#if defined (__flang__)
14+
15+
public :: c_unsigned
16+
17+
#else
18+
19+
integer, parameter :: c_unsigned = c_int
20+
21+
#endif
1422

1523
integer(kind=c_int), parameter, public :: SQLITE_INTEGER = 1
1624
integer(kind=c_int), parameter, public :: SQLITE_FLOAT = 2
@@ -750,15 +758,15 @@ end function sqlite3_prepare_v2_
750758

751759
! int sqlite3_prepare_v3(sqlite3 *db, const char *sql, int nbyte, unsigned int prepFlags, sqlite3_stmt **stmt, const char **tail)
752760
function sqlite3_prepare_v3_(db, sql, nbyte, prep_flags, stmt, tail) bind(c, name='sqlite3_prepare_v3')
753-
import :: c_char, c_int, c_ptr, c_unsigned_int
754-
implicit none
755-
type(c_ptr), intent(in), value :: db
756-
character(kind=c_char), intent(in) :: sql
757-
integer(kind=c_int), intent(in), value :: nbyte
758-
integer(kind=c_unsigned_int), intent(in), value :: prep_flags
759-
type(c_ptr), intent(inout) :: stmt
760-
type(c_ptr), intent(in) :: tail
761-
integer(kind=c_int) :: sqlite3_prepare_v3_
761+
import :: c_char, c_int, c_ptr, c_unsigned
762+
implicit none
763+
type(c_ptr), intent(in), value :: db
764+
character(kind=c_char), intent(in) :: sql
765+
integer(kind=c_int), intent(in), value :: nbyte
766+
integer(kind=c_unsigned), intent(in), value :: prep_flags
767+
type(c_ptr), intent(inout) :: stmt
768+
type(c_ptr), intent(in) :: tail
769+
integer(kind=c_int) :: sqlite3_prepare_v3_
762770
end function sqlite3_prepare_v3_
763771

764772
! int sqlite3_reset(sqlite3_stmt *stmt)
@@ -950,6 +958,7 @@ end subroutine sqlite3_str_reset
950958
end interface
951959

952960
#if SQLITE_ENABLE_COLUMN_METADATA
961+
953962
interface
954963
! const char *sqlite3_column_database_name(sqlite3_stmt *stmt, int icol)
955964
function sqlite3_column_database_name_(stmt, icol) bind(c, name='sqlite3_column_database_name')
@@ -978,6 +987,7 @@ function sqlite3_column_table_name_(stmt, icol) bind(c, name='sqlite3_column_tab
978987
type(c_ptr) :: sqlite3_column_table_name_
979988
end function sqlite3_column_table_name_
980989
end interface
990+
981991
#endif
982992
contains
983993
type(c_ptr) function sqlite3_backup_init(dest, dest_name, source, source_name) result(ptr)
@@ -1250,6 +1260,7 @@ subroutine sqlite3_log(ierr_code, str)
12501260
end subroutine sqlite3_log
12511261

12521262
#if SQLITE_ENABLE_COLUMN_METADATA
1263+
12531264
function sqlite3_column_database_name(stmt, icol) result(name)
12541265
type(c_ptr), intent(inout) :: stmt
12551266
integer, intent(in) :: icol
@@ -1279,5 +1290,6 @@ function sqlite3_column_table_name(stmt, icol) result(name)
12791290
ptr = sqlite3_column_table_name_(stmt, icol)
12801291
call c_f_str_ptr(ptr, name)
12811292
end function sqlite3_column_table_name
1293+
12821294
#endif
12831295
end module sqlite3

0 commit comments

Comments
 (0)