Skip to content

shadowed declaration warnings #1077

@roblatham00

Description

@roblatham00

The STDIO module will throw warnings about shadowed declarations. for example:

In file included from ../../../darshan-runtime/lib/darshan-stdio.c:87:
../../../darshan-runtime/lib/darshan-stdio.c: In function ‘__wrap_fopen’:
../../../darshan-runtime/lib/darshan.h:227:9: warning: declaration of ‘__darshan_disabled’ shadows a previous local [-Wshadow]
  227 |     int __darshan_disabled = darshan_core_disabled_instrumentation()
      |         ^~~~~~~~~~~~~~~~~~
../../../darshan-runtime/lib/darshan-stdio.c:226:5: note: in expansion of macro ‘MAP_OR_FAIL’
  226 |     MAP_OR_FAIL(fileno); \
      |     ^~~~~~~~~~~
../../../darshan-runtime/lib/darshan-stdio.c:327:5: note: in expansion of macro ‘STDIO_RECORD_OPEN’
  327 |     STDIO_RECORD_OPEN(ret, path, tm1, tm2);
      |     ^~~~~~~~~~~~~~~~~
../../../darshan-runtime/lib/darshan.h:227:9: note: shadowed declaration is here
  227 |     int __darshan_disabled = darshan_core_disabled_instrumentation()
      |         ^~~~~~~~~~~~~~~~~~
../../../darshan-runtime/lib/darshan-stdio.c:320:5: note: in expansion of macro ‘MAP_OR_FAIL’
  320 |     MAP_OR_FAIL(fopen);
      |     ^~~~~~~~~~~

MAP_OR_FAIL looks like this:

#define MAP_OR_FAIL(__func) \
    int __darshan_disabled = darshan_core_disabled_instrumentation()

the problem is that STDIO_RECORD_OPEN itself calls MAP_OR_FAIL (but on fileno, not fopen)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Compilation WarningWarning messages appear during compilation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions