Skip to content

Various fixes for FZJ_BenchmarkSfin2/SANS_benchmark2#2517

Merged
willend merged 3 commits into
mccode-dev:mainfrom
willend:main
Jun 25, 2026
Merged

Various fixes for FZJ_BenchmarkSfin2/SANS_benchmark2#2517
willend merged 3 commits into
mccode-dev:mainfrom
willend:main

Conversation

@willend

@willend willend commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Free-form text area

Please describe what your PR is adding in terms of features or bugfixes:

  • Rectification of SPLIT level + %Example target
  • Improved instr doc header
  • Improved comp doc header

Development OS / boundary conditions

Please describe what OS you developed and tested your additions on, and if any special dependencies are required:


PR Checklist for contributing to McStas/McXtrace

For a coherent and useful contribution to McStas/McXtrace, please fill in relevant parts of the checklist:

  • My contribution includes patches to an existing component file

    • I have used the mcdoc utility and rendered a reasonable documentation page for the component (please attach as screenshot in comments!)
    • I have ensured that basic use of the component is OK (e.g. an instrument using it compiles?)
    • I have used the mctest utility to test one or more instruments making use of the component (please attach mcviewtest report as screenshot in comments)
    • I have used the mccode-clangformat tool to apply the standard McCode component indentation scheme
    • I have used the mcrun --c-lint "linter" and followed advice to remove most / all warnings that are raised
  • My contribution includes patches to an existing instrument file

    • I have used the mcdoc utility and rendered a reasonable documentation page for the instrument (please attach as screenshot in comments!)
    • I have used the mctest utility to test the instrument (please attach mcviewtest report as screenshot in comments)
    • I have used the mcrun --c-lint "linter" and followed advice to remove most / all warnings that are raised
  • My contribution contains something else

    • Explanation is added in free form text above or below the checklist

@willend

willend commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author
Screenshot 2026-06-25 at 13 32 29 Screenshot 2026-06-25 at 13 32 12 Screenshot 2026-06-25 at 13 31 46

@willend

willend commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

Lint'ing reveals that the case of a failed fopen is not handled correctly in the comp.

CFLAGS=
DEBUG: CMD: /Users/peterwillendrup/micromamba/envs/mcstas-dev/bin/mcstas finished
INFO: Linting generated code: ./FZJ_BenchmarkSfin2.c
DEBUG: CMD: cppcheck ./FZJ_BenchmarkSfin2.c --check-level=exhaustive --force -DMCDEFAULT_NCOUNT=1000000 -UMC_PORTABLE -DND_BUFFER=10000000 -UNOABSORB_INF_NAN -UOMPI_MPI_H -DSIGABRT -DSIGBREAK -DSIGBUS -DSIGPE -DSIGHUP -DSIGILL -DSIGINT -DSIGKILL -DSIGUSR1 -DSIGUSR2 -DSIGPIPE -DSIGQUIT -DSIGSEGV -DSIGTRAP -DSIGURG -DSIGFPE -DSIGKILL -DSIGTERM -UTEST -UUSE_OPENCL -UWIN32 -UOPENACC -UGCCOFFLOAD -U_MSC_VER -U_MSC_EXTENSIONS -U_WIN32 -UWIN32 -D__unix__ -UDANSE -UFUNNEL -UMC_ANCIENT_COMPATIBILITY -UMC_POL_COMPAT -UNEUTRONICS -Uisnan -Uisinf
Checking FZJ_BenchmarkSfin2.c ...
Checking FZJ_BenchmarkSfin2.c: MCDEFAULT_NCOUNT=1000000;ND_BUFFER=10000000;SIGABRT=1;SIGBREAK=1;SIGBUS=1;SIGPE=1;SIGHUP=1;SIGILL=1;SIGINT=1;SIGKILL=1;SIGUSR1=1;SIGUSR2=1;SIGPIPE=1;SIGQUIT=1;SIGSEGV=1;SIGTRAP=1;SIGURG=1;SIGFPE=1;SIGKILL=1;SIGTERM=1;__unix__=1...
FZJ_BenchmarkSfin2.c:18396:29: warning: If resource allocation fails, then there is a possible null pointer dereference: f2 [nullPointerOutOfResources]
    o2 = (fgets (line1, 80, f2) != NULL);
                            ^
FZJ_BenchmarkSfin2.c:18389:14: note: Assuming allocation function fails
  f2 = fopen ("humanserumalbumin.txt", "r");
             ^
FZJ_BenchmarkSfin2.c:18389:14: note: Assignment 'f2=fopen("humanserumalbumin.txt","r")', assigned value is 0
  f2 = fopen ("humanserumalbumin.txt", "r");
             ^
FZJ_BenchmarkSfin2.c:18396:29: note: Null pointer dereference
    o2 = (fgets (line1, 80, f2) != NULL);
                            ^
Checking FZJ_BenchmarkSfin2.c: MCDEFAULT_NCOUNT=1000000;ND_BUFFER=10000000;SIGABRT=1;SIGBREAK=1;SIGBUS=1;SIGPE=1;SIGHUP=1;SIGILL=1;SIGINT=1;SIGKILL=1;SIGUSR1=1;SIGUSR2=1;SIGPIPE=1;SIGQUIT=1;SIGSEGV=1;SIGTRAP=1;SIGURG=1;SIGFPE=1;SIGKILL=1;SIGTERM=1;__unix__=1;ADJUSTABLE_ESS_PULSE=ADJUSTABLE_ESS_PULSE...

Will leave as is since the related datafiles are not even included with the test-instrument...

@willend willend merged commit 9a6e0ae into mccode-dev:main Jun 25, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant