[GH-ISSUE #208] Compile-time warnings with strict prototypes enabled #170

Closed
opened 2026-05-05 11:49:56 -06:00 by gitea-mirror · 1 comment
Owner

Originally created by @evanmiller on GitHub (Dec 12, 2018).
Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/208

Originally assigned to: @jmcnamara on GitHub.

Adding -Wstrict-prototypes to CFLAGS results in a number of warnings such as:

/path/to/libxlsxwriter/include/xlsxwriter/relationships.h:50:41: warning: this function declaration
      is not a prototype [-Wstrict-prototypes]
lxw_relationships *lxw_relationships_new();

Since C89, functions that take no arguments are supposed to be prototyped as int function(void); rather than int function();. A quick grep shows a number of non-conforming prototypes:

$ grep '();$' include/*/*.h
include/xlsxwriter/app.h:lxw_app *lxw_app_new();
include/xlsxwriter/chartsheet.h:lxw_chartsheet *lxw_chartsheet_new();
include/xlsxwriter/content_types.h:lxw_content_types *lxw_content_types_new();
include/xlsxwriter/core.h:lxw_core *lxw_core_new();
include/xlsxwriter/custom.h:lxw_custom *lxw_custom_new();
include/xlsxwriter/drawing.h:lxw_drawing *lxw_drawing_new();
include/xlsxwriter/format.h:lxw_format *lxw_format_new();
include/xlsxwriter/relationships.h:lxw_relationships *lxw_relationships_new();
include/xlsxwriter/shared_strings.h:lxw_sst *lxw_sst_new();
include/xlsxwriter/styles.h:lxw_styles *lxw_styles_new();
include/xlsxwriter/theme.h:lxw_theme *lxw_theme_new();

Should be an easy fix. I'd recommend adding -Wstrict-prototypes to the default build options to ensure compliance in the future.

Originally created by @evanmiller on GitHub (Dec 12, 2018). Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/208 Originally assigned to: @jmcnamara on GitHub. Adding `-Wstrict-prototypes` to CFLAGS results in a number of warnings such as: ``` /path/to/libxlsxwriter/include/xlsxwriter/relationships.h:50:41: warning: this function declaration is not a prototype [-Wstrict-prototypes] lxw_relationships *lxw_relationships_new(); ``` Since C89, functions that take no arguments are supposed to be prototyped as `int function(void);` rather than `int function();`. A quick grep shows a number of non-conforming prototypes: ``` $ grep '();$' include/*/*.h include/xlsxwriter/app.h:lxw_app *lxw_app_new(); include/xlsxwriter/chartsheet.h:lxw_chartsheet *lxw_chartsheet_new(); include/xlsxwriter/content_types.h:lxw_content_types *lxw_content_types_new(); include/xlsxwriter/core.h:lxw_core *lxw_core_new(); include/xlsxwriter/custom.h:lxw_custom *lxw_custom_new(); include/xlsxwriter/drawing.h:lxw_drawing *lxw_drawing_new(); include/xlsxwriter/format.h:lxw_format *lxw_format_new(); include/xlsxwriter/relationships.h:lxw_relationships *lxw_relationships_new(); include/xlsxwriter/shared_strings.h:lxw_sst *lxw_sst_new(); include/xlsxwriter/styles.h:lxw_styles *lxw_styles_new(); include/xlsxwriter/theme.h:lxw_theme *lxw_theme_new(); ``` Should be an easy fix. I'd recommend adding `-Wstrict-prototypes` to the default build options to ensure compliance in the future.
gitea-mirror 2026-05-05 11:49:56 -06:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@jmcnamara commented on GitHub (Dec 12, 2018):

Thanks. Good catch.

<!-- gh-comment-id:446671863 --> @jmcnamara commented on GitHub (Dec 12, 2018): Thanks. Good catch.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/libxlsxwriter#170
No description provided.