Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: add missing header for difftime #371

Merged
merged 3 commits into from
Sep 3, 2024
Merged

Conversation

thesamesam
Copy link
Contributor

With GCC 14, which makes implicit function declarations an error by default:

TestReadMask.c: In function ‘ElapsedTime’:
TestReadMask.c:746:15: error: implicit declaration of function ‘difftime’ [-Wimplicit-function-declaration]
  746 |     ms = (int)difftime(end_time.tv_sec, start_time.tv_sec);
      |               ^~~~~~~~
TestReadMask.c:62:1: note: ‘difftime’ is defined in header ‘<time.h>’; this is probably fixable by adding ‘#include <time.h>’
   61 | #include <std.c>
  +++ |+#include <time.h>
   62 |

Fix the include guards and include <time.h> unconditionally (for difftime) and <string.h> unconditionally too (for memcpy).

With GCC 14, which makes implicit function declarations an error by default:
```
TestReadMask.c: In function ‘ElapsedTime’:
TestReadMask.c:746:15: error: implicit declaration of function ‘difftime’ [-Wimplicit-function-declaration]
  746 |     ms = (int)difftime(end_time.tv_sec, start_time.tv_sec);
      |               ^~~~~~~~
TestReadMask.c:62:1: note: ‘difftime’ is defined in header ‘<time.h>’; this is probably fixable by adding ‘#include <time.h>’
   61 | #include <std.c>
  +++ |+#include <time.h>
   62 |
```

Fix the include guards and include <time.h> unconditionally (for difftime) and <string.h>
unconditionally too (for memcpy).

Signed-off-by: Sam James <sam@gentoo.org>
@thesamesam
Copy link
Contributor Author

I got another failure with GCC 14 (which makes -Wincompatible-pointer-types) an error by default, but I'm not familiar enough with this codebase to fix it correctly:

dir.c:203:44: error: passing argument 4 of ‘DBPutMultimesh’ from incompatible pointer type [-Wincompatible-pointer-types]
  203 |     DBPutMultimesh(dbfile, "mmesh", nmesh, meshnames, meshtypes, NULL);
      |                                            ^~~~~~~~~
      |                                            |
      |                                            char **
In file included from dir.c:64:
./../src/silo/silo.h:2185:84: note: expected ‘const char * const*’ but argument is of type ‘char **’
 2185 | SILO_API extern int                    DBPutMultimesh(DBfile *, char const *, int, char const * const *, int const *,
      |                                                                                    ^~~~~~~~~~~~~~~~~~~~

@markcmiller86
Copy link
Member

Thanks for the PR. Will review and merge early this coming week.

I got another failure with GCC 14 (which makes -Wincompatible-pointer-types) an error by default, but I'm not familiar enough with this codebase to fix it correctly:

Short answer...its missing a cast to DBCAS_t (constant array of strings) as in

DBPutMultimesh(dbfile, "mmesh", nmesh, (DBCAS_t) meshnames, meshtypes, NULL);

For a longer explanation, see these notes.

@markcmiller86 markcmiller86 merged commit efbe0bf into LLNL:main Sep 3, 2024
2 checks passed
@markcmiller86
Copy link
Member

@thesamesam thanks for contrib 💪🏻

markcmiller86 added a commit that referenced this pull request Sep 3, 2024
tests: add missing header for `difftime`
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.

2 participants