Skip to content

fix compiler warnings regarding too many arguments for c print statements#37

Merged
HaymanConsulting merged 1 commit into
OpenFAST:devfrom
rafmudaf:feature/fix_make_warnings
Jul 26, 2017
Merged

fix compiler warnings regarding too many arguments for c print statements#37
HaymanConsulting merged 1 commit into
OpenFAST:devfrom
rafmudaf:feature/fix_make_warnings

Conversation

@rafmudaf

Copy link
Copy Markdown
Collaborator

The fprintf(... statements in the fast registry module generator have too many arguments. In most cases, no arguments were needed but r->name was given.

@ghost ghost self-assigned this Jul 26, 2017
@ghost ghost requested a review from HaymanConsulting July 26, 2017 03:15

@HaymanConsulting HaymanConsulting left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps for those lines where r->name was included but not used, the intended implementation was:
fprintf(fp, ".... ! %s\n", r->name);
instead of what is currently found in the code:
fprintf(fp, "...\n", r->name);

@ghost

ghost commented Jul 26, 2017

Copy link
Copy Markdown

I think the input argument in these lines was a mistake. This is one of the modified blocks with the lines in question denoted by <-----:

fprintf(fp, "  Re_Xferred  = 1\n");
fprintf(fp, "  Db_Xferred  = 1\n");
fprintf(fp, "  Int_Xferred = 1\n\n");

// Pack data
for ( r = q->fields ; r ; r = r->next ) {
  if (has_deferred_dim(r, 0)){
    // store whether the data type is allocated and the bounds of each dimension
    fprintf(fp, "  IF ( .NOT. %s(InData%%%s) ) THEN\n", assoc_or_allocated(r), r->name);
    fprintf(fp, "    IntKiBuf( Int_Xferred ) = 0\n", r->name); // not allocated   <----- 
    fprintf(fp, "    Int_Xferred = Int_Xferred + 1\n", r->name);   <-----

In this case, the generated code is using a variable Int_Xferred which was initialized just above the fprintf lines I modified.

In another block

fprintf(fp, "      IF(ALLOCATED(Re_Buf )) DEALLOCATE(Re_Buf )\n", r->name);
fprintf(fp, "      IF(ALLOCATED(Db_Buf )) DEALLOCATE(Db_Buf )\n", r->name);
fprintf(fp, "      IF(ALLOCATED(Int_Buf)) DEALLOCATE(Int_Buf)\n", r->name);

these arrays are to be deallocated, so the r->name argument doesn't have a place here.

It seems like someone copied and modified another line but forgot to remove the extra argument.

@bjonkman

Copy link
Copy Markdown
Contributor

@rafaelmudafort is correct. Those are extraneous arguments.

@HaymanConsulting HaymanConsulting merged commit f3016b9 into OpenFAST:dev Jul 26, 2017
@ghost ghost deleted the feature/fix_make_warnings branch August 4, 2017 07:52
@ghost ghost mentioned this pull request Apr 16, 2019
@HYFOAM HYFOAM mentioned this pull request Nov 29, 2020
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.

3 participants