bugGNU Scientific Library - Bugs: bug #36197, reserved identifier violation


You are not allowed to post comments on this tracker with your current authentication level.

bug #36197: reserved identifier violation

Submitter:  Markus Elfring <elfring>
Submitted:  Sun 15 Apr 2012 04:11:38 PM UTC
Category:  Build Severity:  3 - Normal
Operating System:  Status:  None
Assigned to:  None Open/Closed:  Open

Jump to the original submission

Sat 05 Mar 2016 07:23:24 PM UTC, comment #6: 

For completeness, here is a bunch of further reserved
identifiers being used.  (errno.h reserves these as per
C99 Section 7.5)

#define ETA_POS_TABLE_NMAX  100
#define ETA_NEG_TABLE_NMAX  99
#define ETA_NEG_TABLE_SIZE  50
#define EVAL_RESULT(fn) \
#define EVAL_DOUBLE(fn) \
#define EXPAND(x) STRING(x)
#define NAME(x) EXPAND(TYPE(x))
#define ELEMENT(a,stride,i) ((a)[(stride)*(i)])
#define ERR(i) sqrt(gsl_matrix_get(covar,i,i))
#define EXTRA 10
#define EVAL(f,x) ((*((f)->function))(x,(f)->params))
#define EXIT_SUCCESS 0
#define EXIT_FAILURE 1

M Welinder <terra>
Sun 03 Jun 2012 09:14:39 AM UTC, comment #5: 

Appending a UUID would definitely reduce the probability of name clashes.  However, we don't seem to have a name clash problem given that there are no outstanding bugs from name clashes and GSL is more than 16 years old.

Rhys Ulerich <rhysu>
Group administrator
Sun 03 Jun 2012 08:44:48 AM UTC, comment #4: 

How do you think about to append a kind of UUID to your include guards so that the probability for name clashes can be reduced a bit more?

Markus Elfring <elfring>
Sun 03 Jun 2012 01:19:50 AM UTC, comment #3: 

Thanks for the clarification.

So, the double include #defines can be fixed.  Changing the long-standing public APIs isn't an option as it would break existing users.  Unfortunately it's an old set of decisions that are irreversible at this time. 

Unless you object, I'd like to consider "fixing" this bug to be simply changing "__GSL" to "GSL" in the double inclusion guards.

Rhys Ulerich <rhysu>
Group administrator
Sat 02 Jun 2012 09:10:29 PM UTC, comment #2: 

I suggest to be more careful with the use of double underscores for identifiers in your source files.

Would you also like to clarify the interpretation of the word "and" in the referenced paragraph?

Markus Elfring <elfring>
Sat 02 Jun 2012 05:35:19 PM UTC, comment #1: 

I agree that "__GSL_MATH_H_" is problematic according to the link you sent.  That fix is just a judicious 'perl -pi -e' invocation across the code base and should be doable.

At a glance, I'm uncertain why "gsl_mode_t" and "gsl_prec_t" tamper with the POSIX name space.  I see the "ANY header" table entry in the specification you linked.  It seems the clause "End in the string indicated as a reserved suffix in the table and do not use the reserved prefixes posix_, POSIX_, or POSIX, as long as the reserved suffix is in that part of the name considered significant by the implementation." may prevent "gsl_mode_t" from being problematic, e.g., because it does not have a posix-y prefix.

Regardless, changing the GSL types ending with a "_t" would break the existing public APIs.  I don't think this part of your report is fixable.

Rhys Ulerich <rhysu>
Group administrator
Sun 15 Apr 2012 04:11:38 PM UTC, original submission:  

I would like to point out that an identifier like "_GSL_MATH_H_" does not fit to the expected naming convention of the C++ language standard.

Identifiers like "gsl_mode_t" and "gsl_prec_t" tamper with the POSIX name space.

Would you like to adjust your selection for unique names?

Markus Elfring <elfring>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #27728:  36197b.diff added by elfring (180KiB - application/octet-stream - Would you like to integrate these adjustments into your source file repository?)
file #27727:  36197a.diff added by elfring (118KiB - application/octet-stream - Would you like to integrate these adjustments into your source file repository?)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by terra (Posted a comment)
  • -email is unavailable- added by rhysu (Posted a comment)
  • -email is unavailable- added by elfring (Submitted the item)

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-03-30 elfring Attached File- Added 36197a.diff, #27727
        Attached File- Added 36197b.diff, #27728

    Back to the top

    Powered by Savane 3.13-8484.
    Corresponding source code