Skip to content

suggested clang patch: unused variable when compiling fastx_toolkit #28

@JeffreyDeanBrown

Description

@JeffreyDeanBrown

I'm fairly new to suggesting fixes for code, but I think I've got a useful fix for an error that comes up when compiling the toolkit using clang 17. I haven't had this issue when compiling with gcc 11.4.0 on ubuntu, but my colleague had the issue with clang 17 on macOS.

There is an unused variable in the fastx_artifacts_filter code that throws an error, specifically "n_count". I used grep to make sure that variable is not used in any other code (it's not) and just deleted it using a sed script. Here is the script that fixes the issue, run this from the fastx_toolkit-0.0.14 directory:

$ sed -i '88,90d;58d' src/fastx_artifacts_filter/fastx_artifacts_filter.c

Edit (07/26/2024):

Now that I have read more troubleshooting posts online, I think I should have been more explicit with my troubleshooting process.

Specifically, I want to expand on

I used grep to make sure that variable is not used in any other code (it's not)

and say, explicitly, that the command:

grep -rw n_count

within the root directory of the file returns this:

src/fastx_artifacts_filter/fastx_artifacts_filter.c: int n_count=0; src/fastx_artifacts_filter/fastx_artifacts_filter.c: n_count++;
Therefore it appears to be a variable that is declared and incremented, but not used for anything else. I don't think there's going to be future updates for this project, so removing this variable is a viable fix and does not affect the functionality of the program in any way.

However, I think there is a more appropriate solution. I believe this error is simply an elevated "warning" using the -Werror option, which is on it's own harmless (more info here). removing the -Werror option may be more appropriate and prevent future issues with Clang updates, using the command:

sed -i '' 's/-Werror//' configure.ac

Though I no longer have access to a mac to verify this. I will try to verify this using Clang 17 when I have time

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions