patchGNU Autoconf Archive - Patches: patch #6848, ac_c_printf_thsep.m4: Does...

 
 

patch #6848: ac_c_printf_thsep.m4: Does ac_try_compile suffice?

Submitter:  Peter Simons <simons>
Submitted:  Wed 10 Jun 2009 12:03:47 AM UTC
   
 
Priority:  5 - Normal Status:  Done
Assigned to:  simons Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 27 Dec 2009 11:24:03 AM UTC, comment #3: 

The macro in its current form has been marked obsolete, because it cannot reliably detect whether %' is supported or not. The fact that false positive results may occur is particularly unpleasant. In order to be reliable, the macro would have to test a cascade of properties:

1) Does the compiler fail to translate a broken %s or %d format string?

2) Does the compiler fail to translate a broken %' format string?

3) Does the compiler translate a proper %' format string?

4) When run, does sprinf() generate the expected result for %'?

Now, if running test programs is fine, then testing properties (3) and (4) suffices to determine a result.

If test programs cannot be run, i.e. because the build takes place in a cross-compilation environment, then properties (1), (2), and (3) can be tested to determine a result that is not quite perfect -- because the target platform's libc might still be broken --, but at least we know for certain (no false-positives) that the compiler does recognize %' in format strings.

Peter Simons <simons>
Group administrator
Fri 12 Jun 2009 05:21:57 PM UTC, comment #2: 

Hi Bill,

do you care enough about the subject to be willing to update the current version of the macro accordingly?

Take care,
Peter

Peter Simons <simons>
Group administrator
Wed 10 Jun 2009 01:11:31 AM UTC, comment #1: 

Peter,

Yes, I guess you're right. For full generality, it should use AC_RUN_IFELSE instead.

Bill

William J. Poser <billposer>
Wed 10 Jun 2009 12:03:47 AM UTC, original submission:  

Hi Bill,

your macro determines whether printf() supports the ' flag, but the test program is never actually run. I realize that some compilers check these format strings at compile-time and generate an error if the number of parameters don't match, but not all compilers do that. A compiler that doesn't support ', but doesn't check format strings either, will compile and link the test program just fine.

Does that sound right, or did I misunderstand something?

Take care,
Peter

Peter Simons <simons>
Group administrator

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by billposer (Posted a comment)
  • -email is unavailable- added by simons (Submitted the item)
  • -email is unavailable- added by simons (macro author)
  •  

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2009-12-27 simons StatusIn Progress Done
        Open/ClosedOpen Closed
    2009-06-12 simons StatusNone In Progress
    2009-06-10 simons Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code