Skip to content

Commit

Permalink
build: remove gcc attribute specificers
Browse files Browse the repository at this point in the history
Attribute specificers, e.g. __attribute__
((attr)), are specific to gcc. We only had one but
were considering adding others. We'd rather not be
bound to gcc in this way.

Remove attribute suggestion flags from our
makefile, and clean our makefile up a bit.

See https://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html
  • Loading branch information
mcauley-penney committed Jul 17, 2023
1 parent eba85dc commit 73d6488
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
7 changes: 3 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Make manual: hhttps://www.gnu.org/software/make/manual/make.html
# Make manual: https://www.gnu.org/software/make/manual/make.html
# GCC Options: https://gcc.gnu.org/onlinedocs/gcc/Option-Summary.html

# mmv
Expand All @@ -14,7 +14,6 @@ bin_dir = $(prefix)/bin
man_dir = $(prefix)/man/man1

src_dir = src
inc_dir = inc
test_dir = test
debug_dir = debug
build_dir = build
Expand All @@ -31,8 +30,7 @@ w-arith = -Wdouble-promotion -Wfloat-equal
w-basic = -pedantic -Wall -Wextra
w-extra = -Wcast-align=strict -Wconversion -Wpadded -Wshadow -Wstrict-prototypes -Wvla
w-fmt = -Wformat=2 -Wformat-overflow=2 -Wformat-truncation
w-sgst = -Wsuggest-attribute=const -Wsuggest-attribute=malloc -Wsuggest-attribute=noreturn
warn = $(w-basic) $(w-extra) $(w-arith) $(w-fmt) $(w-sgst)
warn = $(w-basic) $(w-extra) $(w-arith) $(w-fmt)

CFLAGS = $(warn) $(optim)

Expand Down Expand Up @@ -70,6 +68,7 @@ debug_clean:
rm -rf $(build_dir)
rm debug_$(bin_name)


# install target for "sudo make install"
install:
$(NORMAL_INSTALL)
Expand Down
2 changes: 1 addition & 1 deletion src/mmv.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ int write_strarr_to_tmpfile(struct Set *map, char tmp_path_template[])
return 0;
}

FILE *__attribute__((malloc)) open_tmpfile_fptr(char *tmp_path)
FILE *open_tmpfile_fptr(char *tmp_path)
{
int tmp_fd = mkstemp(tmp_path);
if (tmp_fd == -1)
Expand Down
2 changes: 1 addition & 1 deletion src/mmv.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ int write_strarr_to_tmpfile(struct Set *map, char tmp_path_template[]);
*
* @return file pointer to opened path
*/
FILE *__attribute__((malloc)) open_tmpfile_fptr(char *tmp_path);
FILE *open_tmpfile_fptr(char *tmp_path);

/**
* @brief gets the user's $EDITOR env variable and opens temp file with it
Expand Down

0 comments on commit 73d6488

Please sign in to comment.