This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [fortran,patch] Don't write common more than once in a module file (PR 30285)


FX Coudert wrote:
Hum, they're static buffers actually, so I don't think I can do that, unfortunately :(

typedef struct gfc_common_head
{
  locus where;
  char use_assoc, saved, threadprivate;
  char name[GFC_MAX_SYMBOL_LEN + 1];
  struct gfc_symbol *head;
  char binding_label[GFC_MAX_BINDING_LABEL_LEN + 1];
  int is_bind_c;
}
gfc_common_head;

Whoops, that's an error then. But I don't think it's worth fixing at this point.


+static int
+compare_written_commons (void *a1, void *b1)
+{
+  const char *aname = ((struct written_common *) a1)->name;
+  const char *alabel = ((struct written_common *) a1)->label;
+  const char *bname = ((struct written_common *) b1)->name;
+  const char *blabel = ((struct written_common *) b1)->label;
+  int c;
+
+  return ((c = strcmp (aname, bname)) != 0 ? c : strcmp (alabel, blabel));
+}

That's smart :-) I just pasted it to write that it's wrong but then I figured it out :-) It would be simpler if you moved the first strcmp two lines up.


The updated patch looks ok.

Thanks,
- Tobi


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]