Skip to content

Fix MSVC C4996 warnings by moving _CRT_SECURE_NO_WARNINGS before includes#106

Merged
JanWielemaker merged 1 commit intoSWI-Prolog:masterfrom
EricGT:fix-jpl-strcpy-warnings
Feb 11, 2026
Merged

Fix MSVC C4996 warnings by moving _CRT_SECURE_NO_WARNINGS before includes#106
JanWielemaker merged 1 commit intoSWI-Prolog:masterfrom
EricGT:fix-jpl-strcpy-warnings

Conversation

@EricGT
Copy link
Contributor

@EricGT EricGT commented Feb 10, 2026

Summary

Fix four MSVC C4996 warnings for strcpy/strcat in jpl.c.

Changes

  • Move existing _CRT_SECURE_NO_WARNINGS define from after SWI-Prolog.h to before all includes
  • The define was already present but placed too late — SWI-Prolog.h pulls in string.h internally, so by that point MSVC had already annotated strcpy/strcat as deprecated

Testing

Built and tested with MSVC (Visual Studio 2026) on Windows x64. All four warnings are resolved.

…udes

The existing _CRT_SECURE_NO_WARNINGS define was placed after
SWI-Prolog.h which already pulls in string.h internally, so the
deprecation annotations were already applied. Move it before all
includes so it takes effect.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@JanWielemaker JanWielemaker merged commit 66c241f into SWI-Prolog:master Feb 11, 2026
1 check passed
@EricGT EricGT deleted the fix-jpl-strcpy-warnings branch February 11, 2026 14:30
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